Load for a JSP
I'm having a regd page where in it registers a particular user ones he fills up the form.
I want the page to b accessed only by 100 users at the same time. If the 101 user accesses the page it shouldn't.Can anyone tell me what all r the constraints i've to follow in this criteria to limit the users for a page at the same time.
# 2
@drvijayy2k2
My friend Database is too costly but your idea of creating a counter is right...
You can Try Saving it under the Scope of ServletContext say something like this.....
PRE-REQUISITE : an attribute named counter should be created already inside the scope of ServletContext.
@ your JSP page your logic should be something similar....
<%
int i = Integer.parseInt(application.getAttribute("counter").toString);
if( i < = 100 )
application.setAttribute("counter",new Integer(i+1)) ;
else{
out.println("Congestion Problem Encountered");
out.close();
}
%>
# 3
hi rahul....
the actual problem is ...it shud not work for the user no. 101..simultaneous users..
let us suppose the counter is now 100..(max.)
now a user tries to access the page..the request is denied...
now a user closes the connection i.e the response obj of a client is dispatched and he closes the browser.
now the counter shud dec. only the another user b able to access
otherwise no other user forever b able to access the page again....
wat say...
suggestions are accepted..
thanx nd regards
sudheer