File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regarding Servlets" Watch "Regarding Servlets" New topic

Regarding Servlets

sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83
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,
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

How about using a HttpSessionListener ?

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

Joined: Mar 22, 2000
Posts: 13036
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.

Ben Souther

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:
Look for SessionMonitor.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Regarding Servlets
It's not a secret anymore!