Package org.apache.mina.handler.multiton
Class SingleSessionIoHandlerAdapter
java.lang.Object
org.apache.mina.handler.multiton.SingleSessionIoHandlerAdapter
- All Implemented Interfaces:
SingleSessionIoHandler
Adapter class for implementors of the
SingleSessionIoHandler
interface. The session to which the handler is assigned is accessible
through the getSession()
method.-
Constructor Summary
ConstructorsConstructorDescriptionSingleSessionIoHandlerAdapter
(IoSession session) Creates a new instance that is assigned to the passed in session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked when any exception is thrown by userIoHandler
implementation or by MINA.protected IoSession
Retrieves the session to which this handler is assigned.void
messageReceived
(Object message) Invoked when protocol message is received.void
messageSent
(Object message) Invoked when protocol message that user requested byIoSession.write(Object)
is sent out actually.void
Invoked when the connection is closed.void
Invoked when the session is created.void
sessionIdle
(IdleStatus status) Invoked when the connection is idle.void
Invoked when the connection is opened.
-
Constructor Details
-
SingleSessionIoHandlerAdapter
Creates a new instance that is assigned to the passed in session.- Parameters:
session
- the session to which the handler is assigned
-
-
Method Details
-
getSession
Retrieves the session to which this handler is assigned.- Returns:
- the session
-
exceptionCaught
Description copied from interface:SingleSessionIoHandler
Invoked when any exception is thrown by userIoHandler
implementation or by MINA. Ifcause
is instanceofIOException
, MINA will close the connection automatically.- Specified by:
exceptionCaught
in interfaceSingleSessionIoHandler
- Parameters:
th
- the caught exception- Throws:
Exception
- See Also:
-
messageReceived
Description copied from interface:SingleSessionIoHandler
Invoked when protocol message is received. Implement your protocol flow here.- Specified by:
messageReceived
in interfaceSingleSessionIoHandler
- Parameters:
message
- the received message- Throws:
Exception
- See Also:
-
messageSent
Description copied from interface:SingleSessionIoHandler
Invoked when protocol message that user requested byIoSession.write(Object)
is sent out actually.- Specified by:
messageSent
in interfaceSingleSessionIoHandler
- Parameters:
message
- the sent message- Throws:
Exception
- See Also:
-
sessionClosed
Description copied from interface:SingleSessionIoHandler
Invoked when the connection is closed. This method is not invoked if the transport type is UDP.- Specified by:
sessionClosed
in interfaceSingleSessionIoHandler
- Throws:
Exception
- See Also:
-
sessionCreated
Description copied from interface:SingleSessionIoHandler
Invoked when the session is created. Initialize default socket parameters and user-defined attributes here.- Specified by:
sessionCreated
in interfaceSingleSessionIoHandler
- Throws:
Exception
- See Also:
-
sessionIdle
Description copied from interface:SingleSessionIoHandler
Invoked when the connection is idle. Refer toIdleStatus
. This method is not invoked if the transport type is UDP.- Specified by:
sessionIdle
in interfaceSingleSessionIoHandler
- Parameters:
status
- the type of idleness- Throws:
Exception
- See Also:
-
sessionOpened
Description copied from interface:SingleSessionIoHandler
Invoked when the connection is opened. This method is not invoked if the transport type is UDP.- Specified by:
sessionOpened
in interfaceSingleSessionIoHandler
- Throws:
Exception
- See Also:
-