⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timecomputelistener.java

📁 一个成熟的论坛
💻 JAVA
字号:
package com.singnet.listener;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.singnet.data.*;
import com.singnet.util.TimeComputeUtils;

public class TimeComputeListener implements HttpSessionListener
{

	public void sessionCreated(HttpSessionEvent event)
	{
		// TODO Auto-generated method stub
		event.getSession().setMaxInactiveInterval(60 * 30);
	}

	public void sessionDestroyed(HttpSessionEvent event)
	{
		// TODO Auto-generated method stub
		HttpSession session = event.getSession();
		if(session.getAttribute(Constants.SESSION_UID) != null) {
			String userID = String.valueOf(session.getAttribute(Constants.SESSION_UID));
			OnlineBean olb = TimeComputeUtils.getOnlineBeanByUserID(userID);
			if(null != olb) {
				TimeComputeUtils.ONLINE_LIST.remove(olb);
				olb.setOnline(false);
			}
		}
		session.invalidate();
	}
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -