Package org.apache.mina.handler.multiton
Interface SingleSessionIoHandler
-
- All Known Implementing Classes:
SingleSessionIoHandlerAdapter
public interface SingleSessionIoHandlerA session handler without anIoSessionparameter for simplicity.A
SingleSessionIoHandleris similar to anIoHandlerwith the notable difference that aSingleSessionIoHandleris used only by one session at a time. Thus, there is noIoSessionparameter 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexceptionCaught(java.lang.Throwable cause)Invoked when any exception is thrown by userIoHandlerimplementation or by MINA.voidmessageReceived(java.lang.Object message)Invoked when protocol message is received.voidmessageSent(java.lang.Object message)Invoked when protocol message that user requested byIoSession.write(Object)is sent out actually.voidsessionClosed()Invoked when the connection is closed.voidsessionCreated()Invoked when the session is created.voidsessionIdle(IdleStatus status)Invoked when the connection is idle.voidsessionOpened()Invoked when the connection is opened.
-
-
-
Method Detail
-
sessionCreated
void sessionCreated() throws java.lang.ExceptionInvoked when the session is created. Initialize default socket parameters and user-defined attributes here.- Throws:
java.lang.Exception- See Also:
IoHandler.sessionCreated(IoSession)
-
sessionOpened
void sessionOpened() throws java.lang.ExceptionInvoked when the connection is opened. This method is not invoked if the transport type is UDP.- Throws:
java.lang.Exception- See Also:
IoHandler.sessionOpened(IoSession)
-
sessionClosed
void sessionClosed() throws java.lang.ExceptionInvoked when the connection is closed. This method is not invoked if the transport type is UDP.- Throws:
java.lang.Exception- See Also:
IoHandler.sessionClosed(IoSession)
-
sessionIdle
void sessionIdle(IdleStatus status) throws java.lang.Exception
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:
java.lang.Exception- See Also:
IoHandler.sessionIdle(IoSession, IdleStatus)
-
exceptionCaught
void exceptionCaught(java.lang.Throwable cause) throws java.lang.ExceptionInvoked when any exception is thrown by userIoHandlerimplementation or by MINA. Ifcauseis instanceofIOException, MINA will close the connection automatically.- Parameters:
cause- the caught exception- Throws:
java.lang.Exception- See Also:
IoHandler.exceptionCaught(IoSession, Throwable)
-
messageReceived
void messageReceived(java.lang.Object message) throws java.lang.ExceptionInvoked when protocol message is received. Implement your protocol flow here.- Parameters:
message- the received message- Throws:
java.lang.Exception- See Also:
IoHandler.messageReceived(IoSession, Object)
-
messageSent
void messageSent(java.lang.Object message) throws java.lang.ExceptionInvoked when protocol message that user requested byIoSession.write(Object)is sent out actually.- Parameters:
message- the sent message- Throws:
java.lang.Exception- See Also:
IoHandler.messageSent(IoSession, Object)
-
-