org.apache.mina.handler.multiton

Class SingleSessionIoHandlerDelegate

Implemented Interfaces:
IoHandler

public class SingleSessionIoHandlerDelegate
extends java.lang.Object
implements IoHandler

An IoHandler implementation which delegates all requests to SingleSessionIoHandlers. A SingleSessionIoHandlerFactory is used to create a new SingleSessionIoHandler for each newly created session.

Field Summary

static String
HANDLER
The key used to store the SingleSessionIoHandler as a session attribute.

Constructor Summary

SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
Creates a new instance that uses the passed in SingleSessionIoHandlerFactory to create new SingleSessionIoHandlers.

Method Summary

void
exceptionCaught(IoSession session, Throwable cause)
Delegates the method call to the SingleSessionIoHandler.exceptionCaught(Throwable) method of the handler assigned to this session.
void
messageReceived(IoSession session, Object message)
Delegates the method call to the SingleSessionIoHandler.messageReceived(Object) method of the handler assigned to this session.
void
messageSent(IoSession session, Object message)
Delegates the method call to the SingleSessionIoHandler.messageSent(Object) method of the handler assigned to this session.
void
sessionClosed(IoSession session)
Delegates the method call to the SingleSessionIoHandler.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 the SingleSessionIoHandler.sessionIdle(IdleStatus) method of the handler assigned to this session.
void
sessionOpened(IoSession session)
Delegates the method call to the SingleSessionIoHandler.sessionOpened() method of the handler assigned to this session.

Field Details

HANDLER

public static final String HANDLER

Constructor Details

SingleSessionIoHandlerDelegate

public SingleSessionIoHandlerDelegate(SingleSessionIoHandlerFactory factory)
Creates a new instance that uses the passed in SingleSessionIoHandlerFactory to create new SingleSessionIoHandlers.
Parameters:
factory - the factory for SingleSessionIoHandlers

Method Details

exceptionCaught

public void exceptionCaught(IoSession session,
                            Throwable cause)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.exceptionCaught(Throwable) method of the handler assigned to this session.
Specified by:
exceptionCaught in interface IoHandler

messageReceived

public void messageReceived(IoSession session,
                            Object message)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.messageReceived(Object) method of the handler assigned to this session.
Specified by:
messageReceived in interface IoHandler

messageSent

public void messageSent(IoSession session,
                        Object message)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.messageSent(Object) method of the handler assigned to this session.
Specified by:
messageSent in interface IoHandler

sessionClosed

public void sessionClosed(IoSession session)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionClosed() method of the handler assigned to this session.
Specified by:
sessionClosed in interface IoHandler

sessionCreated

public void sessionCreated(IoSession session)
            throws Exception
Creates a new instance with the factory passed to the constructor of this class. The created handler is stored as a session attribute named HANDLER.
Specified by:
sessionCreated in interface IoHandler

sessionIdle

public void sessionIdle(IoSession session,
                        IdleStatus status)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionIdle(IdleStatus) method of the handler assigned to this session.
Specified by:
sessionIdle in interface IoHandler

sessionOpened

public void sessionOpened(IoSession session)
            throws Exception
Delegates the method call to the SingleSessionIoHandler.sessionOpened() method of the handler assigned to this session.
Specified by:
sessionOpened in interface IoHandler