Instead of static I would use a member attribute, since for servlets
only one instance exists for a given class.

Ismael wrote:

>  I am making some loading tests, in order to test the loading tool I
> have written some special jsp to deal verify the number of times a jsp
> has been called.
> My jsp is :
>
> <%@page contentType="text/html"%>
> <html>
> <head><title>JSP Page</title></head>
> <body>
> <%!
> static int client=0;
> static String attribute_name="client";
> static Object lock=new Object();
> %>
> <%-- This JSP will be used with 4 other jsp to test the correctness of
> the stress tool
> --%>
> <%
> synchronized (application) {
> session.setAttribute(attribute_name,new Integer(++client));
> System.out.println("Entering client "+client);
>
>
> }
> %>
> </body>
> </html>:
>
>
> It is very simple but the ouput I get is
> Entering client  1
> Entering client  2
> Entering client  3
> Entering client  4
> Entering client  1
> Entering client  1
> Entering client  1
> Entering client  1
> Entering client  1
> Entering client  5
> Entering client  2
> Entering client  3
> Entering client  4
> Entering client  5
> Entering client  6
> Entering client  7
> Entering client  8
> Entering client  9
> Entering client  10
> Entering client  11
> Entering client  12
> Entering client  13
> Entering client  14
> Entering client  15
> Entering client  16
> ..
> That is, my static variable it is being ignored. I am using Orion
> 1.4.5 , Windows 2000 and J2SE 1.3.0_02.
>
> Anybody know why this could be happening ?
>
> Regards,
> Ismael
>
>


Reply via email to