當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。