You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2003/02/06 23:58:37 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session StandardManager.java
costin 2003/02/06 14:58:37
Modified: catalina/src/share/org/apache/catalina/session
StandardManager.java
Log:
Add 2 more fields: number of sessions that expired and number of sessions we rejected
( because we reached the limit ).
This gives info about the activity of the session manager.
Revision Changes Path
1.21 +36 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardManager.java
Index: StandardManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StandardManager.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- StandardManager.java 11 Oct 2002 06:59:35 -0000 1.20
+++ StandardManager.java 6 Feb 2003 22:58:37 -0000 1.21
@@ -181,6 +181,8 @@
*/
private String threadName = "StandardManager";
+ private int rejectedSessions=0;
+ private int expiredSessions=0;
// ------------------------------------------------------------- Properties
@@ -259,6 +261,31 @@
}
+ /** Number of session creations that failed due to maxActiveSessions
+ *
+ * @return
+ */
+ public int getRejectedSessions() {
+ return rejectedSessions;
+ }
+
+ public void setRejectedSessions(int rejectedSessions) {
+ this.rejectedSessions = rejectedSessions;
+ }
+
+ /** Number of sessions that expired.
+ *
+ * @return
+ */
+ public int getExpiredSessions() {
+ return expiredSessions;
+ }
+
+ public void setExpiredSessions(int expiredSessions) {
+ this.expiredSessions = expiredSessions;
+ }
+
+
/**
* Set the maximum number of actives Sessions allowed, or -1 for
@@ -328,9 +355,11 @@
public Session createSession() {
if ((maxActiveSessions >= 0) &&
- (sessions.size() >= maxActiveSessions))
+ (sessions.size() >= maxActiveSessions)) {
+ rejectedSessions++;
throw new IllegalStateException
(sm.getString("standardManager.createSession.ise"));
+ }
return (super.createSession());
@@ -572,7 +601,7 @@
/**
- * Get the lifecycle listeners associated with this lifecycle. If this
+ * Get the lifecycle listeners associated with this lifecycle. If this
* Lifecycle has no listeners registered, a zero-length array is returned.
*/
public LifecycleListener[] findLifecycleListeners() {
@@ -760,6 +789,7 @@
(int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle >= maxInactiveInterval) {
try {
+ expiredSessions++;
session.expire();
} catch (Throwable t) {
log(sm.getString("standardManager.expireException"), t);
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org