public abstract class AbstractServerConnectionHandler extends Object implements SingleSessionIoHandler
Modifier and Type | Field and Description |
---|---|
protected ConnectionInformation |
connectionInformation |
protected IoSession |
ioSession |
protected Messenger |
messenger |
protected PingService |
pingService |
Constructor and Description |
---|
AbstractServerConnectionHandler(IoSession ioSession,
ConnectionInformation connectionInformation) |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUp() |
void |
exceptionCaught(Throwable cause)
Invoked when any exception is thrown by user
IoHandler
implementation or by MINA. |
protected boolean |
getBooleanProperty(String propertyName,
boolean defaultValue) |
protected int |
getIntProperty(String propertyName,
int defaultValue) |
int |
getMessageTimeout() |
int |
getPingPeriod() |
protected Map<String,String> |
getTransportProperties(Properties props) |
void |
messageReceived(Object message)
Invoked when protocol message is received.
|
void |
messageSent(Object message)
Invoked when protocol message that user requested by
IoSession.write(Object) is sent out actually. |
protected void |
modifyFilterChain(IoSession ioSession,
Map<String,String> properties) |
protected void |
replySessionCreated(Properties originalProperties,
Message originalMessage,
Map<String,String> sessionProperties) |
protected void |
sendPrivilegeChange(Set<String> privileges) |
void |
sessionClosed()
Invoked when the connection is closed.
|
protected void |
sessionConfigured(Map<String,String> properties) |
void |
sessionCreated()
Invoked when the session is created.
|
void |
sessionIdle(IdleStatus status)
Invoked when the connection is idle.
|
void |
sessionOpened()
Invoked when the connection is opened.
|
protected void |
startSession() |
protected IoSession ioSession
protected final Messenger messenger
protected final PingService pingService
protected final ConnectionInformation connectionInformation
public AbstractServerConnectionHandler(IoSession ioSession, ConnectionInformation connectionInformation)
protected void modifyFilterChain(IoSession ioSession, Map<String,String> properties)
protected Map<String,String> getTransportProperties(Properties props)
protected void replySessionCreated(Properties originalProperties, Message originalMessage, Map<String,String> sessionProperties)
public void exceptionCaught(Throwable cause) throws Exception
SingleSessionIoHandler
IoHandler
implementation or by MINA. If cause
is instanceof
IOException
, MINA will close the connection automatically.exceptionCaught
in interface SingleSessionIoHandler
cause
- the caught exceptionException
IoHandler.exceptionCaught(IoSession, Throwable)
public void messageReceived(Object message) throws Exception
SingleSessionIoHandler
messageReceived
in interface SingleSessionIoHandler
message
- the received messageException
IoHandler.messageReceived(IoSession, Object)
protected void startSession()
public void messageSent(Object message) throws Exception
SingleSessionIoHandler
IoSession.write(Object)
is sent out actually.messageSent
in interface SingleSessionIoHandler
message
- the sent messageException
IoHandler.messageSent(IoSession, Object)
public void sessionClosed() throws Exception
SingleSessionIoHandler
sessionClosed
in interface SingleSessionIoHandler
Exception
IoHandler.sessionClosed(IoSession)
protected void cleanUp()
public void sessionCreated() throws Exception
SingleSessionIoHandler
sessionCreated
in interface SingleSessionIoHandler
Exception
IoHandler.sessionCreated(IoSession)
public void sessionIdle(IdleStatus status) throws Exception
SingleSessionIoHandler
IdleStatus
. This
method is not invoked if the transport type is UDP.sessionIdle
in interface SingleSessionIoHandler
status
- the type of idlenessException
IoHandler.sessionIdle(IoSession, IdleStatus)
public void sessionOpened() throws Exception
SingleSessionIoHandler
sessionOpened
in interface SingleSessionIoHandler
Exception
IoHandler.sessionOpened(IoSession)
public int getPingPeriod()
public int getMessageTimeout()
protected boolean getBooleanProperty(String propertyName, boolean defaultValue)
protected int getIntProperty(String propertyName, int defaultValue)