Re: Concurrent Users

Chris Pratt <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.