Thanks a lot Chris...But will it work in clustered environment where we can have 2 or more number of web containers. Is it possible to get the count in Clustered Environment?
-----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED] On Behalf Of Chris Pratt Sent: Wednesday, June 16, 2004 9:23 PM To: [EMAIL PROTECTED] Subject: Re: Concurrent Users Two things to note. Since there is no way to positively no when a user has left your site, there's no accurate way of knowing how many users are currently viewing your site. With that said, if you want to count the number of outstanding users whose sessions have not timed out, make a User object that you store in the Session (or use your existing one) and have it implement the HttpSessionBindingListener interface. Create a Class level variable (i.e. static) to hold the count which gets incremented on each call to valueBound() and decremented on each call to valueUnbound(). (*Chris*) Original Message ----------------------- You can keep a class level variable. Increment that when the user joins in the session and decrement that when the session times out or when you invalidate the session. >From: Khalid Umar <[EMAIL PROTECTED]> >Reply-To: "A mailing list for discussion about Sun Microsystem's Java > Servlet API Technology." <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Concurrent Users >Date: Wed, 16 Jun 2004 16:45:52 +0530 > >Is there a way to find out the number of concurrent users logged into a >web application? > >_______________________________________________________________________ ____ >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff SERVLET-INTEREST". > >Archives: http://archives.java.sun.com/archives/servlet-interest.html >Resources: http://java.sun.com/products/servlet/external-resources.html >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html _________________________________________________________________ Getting married? Find great tips, tools and the latest trends at MSN Life Events. http://lifeevents.msn.com/category.aspx?cid=married ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html