本文整理汇总了Java中org.apache.mina.common.IoSession.removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java IoSession.removeAttribute方法的具体用法?Java IoSession.removeAttribute怎么用?Java IoSession.removeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.common.IoSession
的用法示例。
在下文中一共展示了IoSession.removeAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sessionClosed
import org.apache.mina.common.IoSession; //导入方法依赖的package包/类
@Override
public void sessionClosed(final IoSession session) throws Exception {
final MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
if (client != null) {
byte state = MapleClient.CHANGE_CHANNEL;
if (!LoginServer.isShutdown() && client.getPlayer() != null) {
state = client.getLoginState();
}
if (state != MapleClient.CHANGE_CHANNEL) {
if (System.currentTimeMillis() - lastDC < 60000) { //within the minute
numDC++;
if (numDC > 100) { //100+ people have dc'd in minute in channelserver
System.out.println("Writing log...");
numDC = 0;
lastDC = System.currentTimeMillis(); // intentionally place here
}
} else {
numDC = 0;
lastDC = System.currentTimeMillis(); // intentionally place here
}
}
session.close();
client.disconnect(true, false);
session.removeAttribute(MapleClient.CLIENT_KEY);
}
super.sessionClosed(session);
}
示例2: sessionClosed
import org.apache.mina.common.IoSession; //导入方法依赖的package包/类
@Override
public void sessionClosed(final IoSession session) throws Exception {
synchronized (session) {
final MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
if (client != null) {
client.disconnect();
LoginWorker.getInstance().deregisterClient(client);
session.removeAttribute(MapleClient.CLIENT_KEY);
}
}
super.sessionClosed(session);
}
示例3: removeChannelIfDisconnectd
import org.apache.mina.common.IoSession; //导入方法依赖的package包/类
static void removeChannelIfDisconnectd(IoSession session) {
if (session != null && ! session.isConnected()) {
session.removeAttribute(CHANNEL_KEY);
}
}