Package org.apache.mina.handler.multiton
Class SingleSessionIoHandlerDelegate
- java.lang.Object
-
- org.apache.mina.handler.multiton.SingleSessionIoHandlerDelegate
-
- All Implemented Interfaces:
IoHandler
public class SingleSessionIoHandlerDelegate extends java.lang.Object implements IoHandler
AnIoHandler
implementation which delegates all requests toSingleSessionIoHandler
s. ASingleSessionIoHandlerFactory
is used to create a newSingleSessionIoHandler
for each newly created session.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HANDLER
The key used to store theSingleSessionIoHandler
as a session attribute.
-
Constructor Summary
Constructors Constructor Description SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
Creates a new instance that uses the passed inSingleSessionIoHandlerFactory
to create newSingleSessionIoHandler
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exceptionCaught(IoSession session, java.lang.Throwable cause)
Delegates the method call to theSingleSessionIoHandler.exceptionCaught(Throwable)
method of the handler assigned to this session.void
messageReceived(IoSession session, java.lang.Object message)
Delegates the method call to theSingleSessionIoHandler.messageReceived(Object)
method of the handler assigned to this session.void
messageSent(IoSession session, java.lang.Object message)
Delegates the method call to theSingleSessionIoHandler.messageSent(Object)
method of the handler assigned to this session.void
sessionClosed(IoSession session)
Delegates the method call to theSingleSessionIoHandler.sessionClosed()
method of the handler assigned to this session.void
sessionCreated(IoSession session)
Creates a new instance with the factory passed to the constructor of this class.void
sessionIdle(IoSession session, IdleStatus status)
Delegates the method call to theSingleSessionIoHandler.sessionIdle(IdleStatus)
method of the handler assigned to this session.void
sessionOpened(IoSession session)
Delegates the method call to theSingleSessionIoHandler.sessionOpened()
method of the handler assigned to this session.
-
-
-
Field Detail
-
HANDLER
public static final java.lang.String HANDLER
The key used to store theSingleSessionIoHandler
as a session attribute.
-
-
Constructor Detail
-
SingleSessionIoHandlerDelegate
public SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
Creates a new instance that uses the passed inSingleSessionIoHandlerFactory
to create newSingleSessionIoHandler
s.- Parameters:
factory
- the factory forSingleSessionIoHandler
s
-
-
Method Detail
-
sessionCreated
public void sessionCreated(IoSession session) throws java.lang.Exception
Creates a new instance with the factory passed to the constructor of this class. The created handler is stored as a session attribute namedHANDLER
.- Specified by:
sessionCreated
in interfaceIoHandler
- Throws:
java.lang.Exception
- See Also:
IoHandler.sessionCreated(org.apache.mina.common.IoSession)
-
sessionOpened
public void sessionOpened(IoSession session) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.sessionOpened()
method of the handler assigned to this session.- Specified by:
sessionOpened
in interfaceIoHandler
- Throws:
java.lang.Exception
-
sessionClosed
public void sessionClosed(IoSession session) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.sessionClosed()
method of the handler assigned to this session.- Specified by:
sessionClosed
in interfaceIoHandler
- Throws:
java.lang.Exception
-
sessionIdle
public void sessionIdle(IoSession session, IdleStatus status) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.sessionIdle(IdleStatus)
method of the handler assigned to this session.- Specified by:
sessionIdle
in interfaceIoHandler
- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(IoSession session, java.lang.Throwable cause) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.exceptionCaught(Throwable)
method of the handler assigned to this session.- Specified by:
exceptionCaught
in interfaceIoHandler
- Throws:
java.lang.Exception
-
messageReceived
public void messageReceived(IoSession session, java.lang.Object message) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.messageReceived(Object)
method of the handler assigned to this session.- Specified by:
messageReceived
in interfaceIoHandler
- Throws:
java.lang.Exception
-
messageSent
public void messageSent(IoSession session, java.lang.Object message) throws java.lang.Exception
Delegates the method call to theSingleSessionIoHandler.messageSent(Object)
method of the handler assigned to this session.- Specified by:
messageSent
in interfaceIoHandler
- Throws:
java.lang.Exception
-
-