本文整理汇总了Java中org.apache.mina.core.session.IoSession.closeNow方法的典型用法代码示例。如果您正苦于以下问题:Java IoSession.closeNow方法的具体用法?Java IoSession.closeNow怎么用?Java IoSession.closeNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.session.IoSession
的用法示例。
在下文中一共展示了IoSession.closeNow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exceptionCaught
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
* Handle the exception we got.
*
* @param session The session we got the exception on
* @param cause The exception cause
* @throws Exception The t
*/
@Override
public void exceptionCaught( IoSession session, Throwable cause ) throws Exception
{
LOG.warn( cause.getMessage(), cause );
session.setAttribute( EXCEPTION_KEY, cause );
if ( cause instanceof ProtocolEncoderException )
{
Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause();
if ( realCause instanceof MessageEncoderException )
{
int messageId = ( ( MessageEncoderException ) realCause ).getMessageId();
ResponseFuture<?> response = futureMap.get( messageId );
response.cancel( true );
response.setCause( realCause );
}
}
session.closeNow();
}
示例2: doExec
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void doExec(TcpMessage message, IoSession session) {
CjyTcpMessage tcpMsg = (CjyTcpMessage)message;
logger.debug(message.getCmd() + "-----------------" );
//登出响应消息
CjyTcpMessage logoutReq = new CjyTcpMessage();
logoutReq.setAddress(tcpMsg.getAddress());
logoutReq.setCmd(TcpNetCmd.ACK & TcpNetCmd.LOGOUT_ID);
logoutReq.setLength(0);
session.write(logoutReq);
//TODO 删除session信息
session.closeNow();
}
示例3: exceptionCaught
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
session.closeNow();
LOGGER.error("Caught exception", cause);
}
示例4: exceptionCaught
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void exceptionCaught(IoSession session, Throwable cause) {
session.closeNow();
}
示例5: inputClosed
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void inputClosed( IoSession session ) throws Exception
{
session.closeNow();
}
示例6: exceptionCaught
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
session.closeNow();
}
示例7: exceptionCaught
import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
logger.error("Exception in session from [{}<->{}]", cause, session.getLocalAddress(), session.getRemoteAddress());
session.closeNow();
}