- From: Wes Biggs <wes@cacas.org>
- Date: Thu, 2 Mar 2000 10:54:25 -0800 (PST)
- To: Walter do Valle <walter@softplan.com.br>
- cc: www-jigsaw@w3.org
If you want the number of concurrent requests to a particular servlet, I
would suggest you declare it as an application-scope variable. At the
beginning of your service method, increment a counter, at the end,
decrement it:
ServletContext application = getServletContext();
Integer count = null;
synchronized (application) {
count = (Integer) application.getAttribute("countMyServlet");
if (count == null) count = new Integer(1);
else count = new Integer(count.intValue() + 1);
application.setAttribute("countMyServlet", count);
}
// bulk of service()/doGet()/doPost() here
synchronized (application) {
count = new Integer(count.intValue() - 1);
application.setAttribute("countMyServlet", count);
}
I would put the decrement operation in a finally {} clause to be safe.
Wes
Because this integrity cannot be altered, the guaranteed e-mail
of communication can be electronically.
On Thu, 2 Mar 2000, Walter do Valle wrote:
>
> Hello list
>
> I am developing a servlet that generates a consult accessing a DB2
> database. My web server is JigSaw. My question is: is it possible my
> servlet count the number os users accessing my servlet? Have JigSaw any
> parameter that "tell" me how much users are accessing it at same time?
>
> Thank you for all.
>
> Hugs
>
> Walter
>
Received on Thursday, 2 March 2000 14:05:58 UTC