当前位置: 首页>>代码示例>>Java>>正文


Java IoSession.isClosing方法代码示例

本文整理汇总了Java中org.apache.mina.core.session.IoSession.isClosing方法的典型用法代码示例。如果您正苦于以下问题:Java IoSession.isClosing方法的具体用法?Java IoSession.isClosing怎么用?Java IoSession.isClosing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mina.core.session.IoSession的用法示例。


在下文中一共展示了IoSession.isClosing方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: messageReceived

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
/**
 * Receives data from the remote host, passes to the handler if a handshake is in progress, 
 * otherwise passes on transparently.
 * 
 * @param nextFilter the next filter in filter chain
 * @param session the session object
 * @param message the object holding the received data
 */
@Override
public void messageReceived(final NextFilter nextFilter, final IoSession session, final Object message)
        throws ProxyAuthException {
    ProxyLogicHandler handler = getProxyHandler(session);

    synchronized (handler) {
        IoBuffer buf = (IoBuffer) message;

        if (handler.isHandshakeComplete()) {
            // Handshake done - pass data on as-is
            nextFilter.messageReceived(session, buf);

        } else {
            LOGGER.debug(" Data Read: {} ({})", handler, buf);

            // Keep sending handshake data to the handler until we run out
            // of data or the handshake is finished
            while (buf.hasRemaining() && !handler.isHandshakeComplete()) {
                LOGGER.debug(" Pre-handshake - passing to handler");

                int pos = buf.position();
                handler.messageReceived(nextFilter, buf);

                // Data not consumed or session closing
                if (buf.position() == pos || session.isClosing()) {
                    return;
                }
            }

            // Pass on any remaining data to the next filter
            if (buf.hasRemaining()) {
                LOGGER.debug(" Passing remaining data to next filter");

                nextFilter.messageReceived(session, buf);
            }
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:47,代码来源:ProxyFilter.java

示例2: sessionIdle

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
public void sessionIdle(IoSession session, IdleStatus status)  throws Exception {
	System.out.println("sessionIdle……");
	if(session.isClosing()){
		System.out.println("sessionIdle      Closed");
	}else{
		if((System.currentTimeMillis()-session.getLastReadTime())>1000*60*2){
			System.err.println(session.getId()+"  ----------------Out of time, close user session");
			session.close(true);
		}
	}
}
 
开发者ID:langxianwei,项目名称:iot-plat,代码行数:12,代码来源:ServerHandler.java

示例3: removeOutGame

import org.apache.mina.core.session.IoSession; //导入方法依赖的package包/类
public static void removeOutGame(String name) {
    IoSession ss = outGame.remove(name);
    if (ss != null) {
        if (!ss.isClosing()) {
            broadcastOutGame(GMPacketCreator.removeUser(name), null);
            broadcastOutGame(GMPacketCreator.chat(name + " has logged out."), null);
        }
    }
}
 
开发者ID:NovaStory,项目名称:AeroStory,代码行数:10,代码来源:GMServer.java


注:本文中的org.apache.mina.core.session.IoSession.isClosing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。