Package org.apache.mina.handler.multiton
Interface SingleSessionIoHandler
- All Known Implementing Classes:
SingleSessionIoHandlerAdapter
public interface SingleSessionIoHandler
A session handler without an
IoSession parameter for simplicity.
A SingleSessionIoHandler is similar to an IoHandler with
the notable difference that a SingleSessionIoHandler is used only
by one session at a time. Thus, there is no IoSession parameter in
the methods of this interface.
Because events are passed to the session in order, it is possible to store conversational state as instance variables in this object.
-
Method Summary
Modifier and TypeMethodDescriptionvoidexceptionCaught(Throwable cause) Invoked when any exception is thrown by userIoHandlerimplementation or by MINA.voidmessageReceived(Object message) Invoked when protocol message is received.voidmessageSent(Object message) Invoked when protocol message that user requested byIoSession.write(Object)is sent out actually.voidInvoked when the connection is closed.voidInvoked when the session is created.voidsessionIdle(IdleStatus status) Invoked when the connection is idle.voidInvoked when the connection is opened.
-
Method Details
-
sessionCreated
Invoked when the session is created. Initialize default socket parameters and user-defined attributes here.- Throws:
Exception- See Also:
-
sessionOpened
Invoked when the connection is opened. This method is not invoked if the transport type is UDP.- Throws:
Exception- See Also:
-
sessionClosed
Invoked when the connection is closed. This method is not invoked if the transport type is UDP.- Throws:
Exception- See Also:
-
sessionIdle
Invoked when the connection is idle. Refer toIdleStatus. This method is not invoked if the transport type is UDP.- Parameters:
status- the type of idleness- Throws:
Exception- See Also:
-
exceptionCaught
Invoked when any exception is thrown by userIoHandlerimplementation or by MINA. Ifcauseis instanceofIOException, MINA will close the connection automatically.- Parameters:
cause- the caught exception- Throws:
Exception- See Also:
-
messageReceived
Invoked when protocol message is received. Implement your protocol flow here.- Parameters:
message- the received message- Throws:
Exception- See Also:
-
messageSent
Invoked when protocol message that user requested byIoSession.write(Object)is sent out actually.- Parameters:
message- the sent message- Throws:
Exception- See Also:
-