org.elkoserver.foundation.net
Interface MessageHandler

All Known Implementing Classes:
Actor, InternalActor, NonRoutingActor, NullMessageHandler, RoutingActor, ServiceActor, WorkshopActor

public interface MessageHandler

Interface for objects that handle events on a Connection. An implementor of this interface is associated with each Connection object, to handle both incoming messages and disconnection events. Normally, a Connection's MessageHandler is produced by a MessageHandlerFactory when the connection is established. The factory is held by the NetworkManager for this purpose.


Method Summary
 void connectionDied(Connection connection, Throwable reason)
          Cope with connection death.
 void processMessage(Connection connection, Object message)
          Process an incoming message from a connection.
 

Method Detail

connectionDied

void connectionDied(Connection connection,
                    Throwable reason)
Cope with connection death. The connection might have been shut down deliberately, the underlying TCP connection might have failed, or an internal error may have killed the connection. In any event, the connection is dead. Deal with it.

Parameters:
connection - The connection that has just died.
reason - A possible indication why the connection went away.

processMessage

void processMessage(Connection connection,
                    Object message)
Process an incoming message from a connection.

Parameters:
connection - The connection upon which the message arrived.
message - The incoming message.