fabric.worker.remote
Class ConnectionHandler

java.lang.Object
  extended by fabric.common.AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>
      extended by fabric.worker.remote.ConnectionHandler

public class ConnectionHandler
extends AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>

Manages a connection with a remote worker. The connection is used to receive requests from and to send responses to the node.

XXX Assumes connections never get dropped.


Constructor Summary
ConnectionHandler(RemoteCallManager rcm)
           
 
Method Summary
protected  java.lang.Object getNodeByName(java.lang.String name)
           
protected  java.lang.String getThreadName(java.net.SocketAddress remote, SessionAttributes session)
          Returns the name for the message-handler thread that will be handling the given connection.
protected  void logAuthenticationFailure()
          Logs an authentication failure of the remote host.
protected  void logSession(java.net.SocketAddress remote, SessionAttributes session)
          Logs a successful connection.
protected  SessionAttributes newAuthenticatedSession(java.lang.Object node, java.lang.String remoteNodeName, java.lang.String remoteNodePrincipalName, NodePrincipal remoteNodePrincipal)
           
protected  SessionAttributes newUnauthenticatedSession(java.lang.Object node, java.lang.String remoteNodeName)
           
 
Methods inherited from class fabric.common.AbstractConnectionHandler
handle, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionHandler

public ConnectionHandler(RemoteCallManager rcm)
Method Detail

getNodeByName

protected java.lang.Object getNodeByName(java.lang.String name)
Specified by:
getNodeByName in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>
Returns:
an object representing the node with the given name. Can be null if the node doesn't exist at this host.

getThreadName

protected java.lang.String getThreadName(java.net.SocketAddress remote,
                                         SessionAttributes session)
Description copied from class: AbstractConnectionHandler
Returns the name for the message-handler thread that will be handling the given connection.

Specified by:
getThreadName in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>

logAuthenticationFailure

protected void logAuthenticationFailure()
Description copied from class: AbstractConnectionHandler
Logs an authentication failure of the remote host.

Specified by:
logAuthenticationFailure in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>

logSession

protected void logSession(java.net.SocketAddress remote,
                          SessionAttributes session)
Description copied from class: AbstractConnectionHandler
Logs a successful connection.

Specified by:
logSession in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>

newAuthenticatedSession

protected SessionAttributes newAuthenticatedSession(java.lang.Object node,
                                                    java.lang.String remoteNodeName,
                                                    java.lang.String remoteNodePrincipalName,
                                                    NodePrincipal remoteNodePrincipal)
Specified by:
newAuthenticatedSession in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>
Parameters:
node - the local node with which the session was established.
remoteNodeName - the name of the remote node.
remoteNodePrincipalName - the String representation of the remote node's principal.
remoteNodePrincipal - the NodePrincipal corresponding to the remote node.
Returns:
a Session object representing an authenticated, encrypted session.

newUnauthenticatedSession

protected SessionAttributes newUnauthenticatedSession(java.lang.Object node,
                                                      java.lang.String remoteNodeName)
Overrides:
newUnauthenticatedSession in class AbstractConnectionHandler<java.lang.Object,SessionAttributes,MessageHandlerThread>
Parameters:
node - the local node with which the session was established.
remoteNodeName - the name of the remote node.
Returns:
a Session object representing an unauthenticated, unencrypted session. A null value is returned if this node doesn't support this type of session.