Java Code Examples for com.jme3.network.HostedConnection#getAttribute()

The following examples show how to use com.jme3.network.HostedConnection#getAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RpcHostedService.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 *  Removes any RPC hosting services associated with the specified
 *  connection.  Calls to getRpcConnection() will return null for
 *  this connection.  The connection's RpcConnection is also closed,
 *  releasing any waiting synchronous calls with a "Connection closing"
 *  error.
 *  This method is called automatically for all leaving connections if
 *  autohost is set to true.
 */
@Override
public void stopHostingOnConnection( HostedConnection hc ) {
    RpcConnection rpc = hc.getAttribute(ATTRIBUTE_NAME);
    if( rpc == null ) {
        return;
    }
    if( log.isLoggable(Level.FINEST) ) {
        log.log(Level.FINEST, "stopHostingOnConnection:{0}", hc);
    }
    hc.setAttribute(ATTRIBUTE_NAME, null);
    rpc.close();
}
 
Example 2
Source File: RmiHostedService.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 *  Removes any RMI hosting services associated with the specified
 *  connection.  Calls to getRmiRegistry() will return null for
 *  this connection.  
 *  This method is called automatically for all leaving connections if
 *  autohost is set to true.
 */
public void stopHostingOnConnection( HostedConnection hc ) {
    RmiRegistry rmi = hc.getAttribute(ATTRIBUTE_NAME);
    if( rmi == null ) {
        return;
    }
    if( log.isLoggable(Level.FINEST) ) {
        log.log(Level.FINEST, "stopHostingOnConnection:{0}", hc);
    }
    hc.setAttribute(ATTRIBUTE_NAME, null);
    //rpc.close();
}
 
Example 3
Source File: SessionDataDelegator.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 *  Returns the attributeName attribute of the supplied source
 *  HostConnection.  If there is no value at that attribute then
 *  the miss() method is called.
 */   
@Override
protected Object getSourceDelegate( HostedConnection source ) {
    Object result = source.getAttribute(attributeName);
    if( result == null ) {
        miss(source);
    }
    return result;
}
 
Example 4
Source File: RpcHostedService.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 *  Retrieves the RpcConnection for the specified HostedConnection
 *  if that HostedConnection has had RPC services started using
 *  startHostingOnConnection() (or via autohosting).  Returns null
 *  if the connection currently doesn't have RPC hosting services
 *  attached.
 */
public RpcConnection getRpcConnection( HostedConnection hc ) {
    return hc.getAttribute(ATTRIBUTE_NAME);
}
 
Example 5
Source File: RmiHostedService.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 *  Returns the RMI registry for the specific HostedConnection.  Each connection
 *  has its own registry with its own connection-specific shared objects.
 */
public RmiRegistry getRmiRegistry( HostedConnection hc ) {
    return hc.getAttribute(ATTRIBUTE_NAME);
}