sessioncounter.java

来自「企业进销存源码」· Java 代码 · 共 26 行

JAVA
26
字号
package com.web.util;

/**
 * @author asus
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
import javax.servlet.*;
import javax.servlet.http.*;
public class SessionCounter implements HttpSessionListener {
	private static int activeSessions = 0;
	public void sessionCreated(HttpSessionEvent se) {
		activeSessions++;
	}
	public void sessionDestroyed(HttpSessionEvent se) {
		if (activeSessions > 0)
			activeSessions--;
	}
	public static int getActiveSessions() {
		return activeSessions;
	}
}

⌨️ 快捷键说明

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