本文整理匯總了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();
}