wood burning stoves 2.0*
The moose likes Servlets and the fly likes Regarding Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regarding Servlets" Watch "Regarding Servlets" New topic
Author

Regarding Servlets

sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83
Hi,
This is sirisha I have a Doubt any one Can Help Me?

How Can we find How many Users are accessing one website at any moment of time?

Thanks && Regards,
Sirisha.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

How about using a HttpSessionListener ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
How many Users are accessing one website at any moment of time?


That depends on how you interpret the phrase. Watching sessions will give you some idea of the number of active Users in recent history but some will be long gone by the time their session times out. Using Tomcat's management interface I can see how many Threads are currently handling requests - is that what you had in mind? You could always increment (safely) a counter when the service method is entered and decrement it when exited.

Bill
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see: UseAMeaningfulSubjectLine

Every question in the forum is "Regarding Servlets" so your subject line really tells us nothing about your question.

I've got a sample webapp on my site that shows one way of keeping track of sessions, who's logged in, how long they've been logged in, and what page they've accessed last.
You can find it at:
http://simple.souther.us/not-so-simple.html
Look for SessionMonitor.

-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
Don't get me started about those stupid light bulbs.
 
subject: Regarding Servlets