Package org.apache.mina.handler.multiton
Class SingleSessionIoHandlerAdapter
- java.lang.Object
-
- org.apache.mina.handler.multiton.SingleSessionIoHandlerAdapter
-
- All Implemented Interfaces:
SingleSessionIoHandler
public class SingleSessionIoHandlerAdapter extends java.lang.Object implements SingleSessionIoHandler
Adapter class for implementors of theSingleSessionIoHandlerinterface. The session to which the handler is assigned is accessible through thegetSession()method.
-
-
Constructor Summary
Constructors Constructor Description SingleSessionIoHandlerAdapter(IoSession session)Creates a new instance that is assigned to the passed in session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexceptionCaught(java.lang.Throwable th)Invoked when any exception is thrown by userIoHandlerimplementation or by MINA.protected IoSessiongetSession()Retrieves the session to which this handler is assigned.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.
-
-
-
Constructor Detail
-
SingleSessionIoHandlerAdapter
public SingleSessionIoHandlerAdapter(IoSession session)
Creates a new instance that is assigned to the passed in session.- Parameters:
session- the session to which the handler is assigned
-
-
Method Detail
-
getSession
protected IoSession getSession()
Retrieves the session to which this handler is assigned.- Returns:
- the session
-
exceptionCaught
public void exceptionCaught(java.lang.Throwable th) throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when any exception is thrown by userIoHandlerimplementation or by MINA. Ifcauseis instanceofIOException, MINA will close the connection automatically.- Specified by:
exceptionCaughtin interfaceSingleSessionIoHandler- Parameters:
th- the caught exception- Throws:
java.lang.Exception- See Also:
IoHandler.exceptionCaught(IoSession, Throwable)
-
messageReceived
public void messageReceived(java.lang.Object message) throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when protocol message is received. Implement your protocol flow here.- Specified by:
messageReceivedin interfaceSingleSessionIoHandler- Parameters:
message- the received message- Throws:
java.lang.Exception- See Also:
IoHandler.messageReceived(IoSession, Object)
-
messageSent
public void messageSent(java.lang.Object message) throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when protocol message that user requested byIoSession.write(Object)is sent out actually.- Specified by:
messageSentin interfaceSingleSessionIoHandler- Parameters:
message- the sent message- Throws:
java.lang.Exception- See Also:
IoHandler.messageSent(IoSession, Object)
-
sessionClosed
public void sessionClosed() throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when the connection is closed. This method is not invoked if the transport type is UDP.- Specified by:
sessionClosedin interfaceSingleSessionIoHandler- Throws:
java.lang.Exception- See Also:
IoHandler.sessionClosed(IoSession)
-
sessionCreated
public void sessionCreated() throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when the session is created. Initialize default socket parameters and user-defined attributes here.- Specified by:
sessionCreatedin interfaceSingleSessionIoHandler- Throws:
java.lang.Exception- See Also:
IoHandler.sessionCreated(IoSession)
-
sessionIdle
public void sessionIdle(IdleStatus status) throws java.lang.Exception
Description copied from interface:SingleSessionIoHandlerInvoked when the connection is idle. Refer toIdleStatus. This method is not invoked if the transport type is UDP.- Specified by:
sessionIdlein interfaceSingleSessionIoHandler- Parameters:
status- the type of idleness- Throws:
java.lang.Exception- See Also:
IoHandler.sessionIdle(IoSession, IdleStatus)
-
sessionOpened
public void sessionOpened() throws java.lang.ExceptionDescription copied from interface:SingleSessionIoHandlerInvoked when the connection is opened. This method is not invoked if the transport type is UDP.- Specified by:
sessionOpenedin interfaceSingleSessionIoHandler- Throws:
java.lang.Exception- See Also:
IoHandler.sessionOpened(IoSession)
-
-