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.

[344 byte] By [bronze-starDukes] at [2007-11-26 12:11:02]
# 1
its my suggess***************u just add one field in database table as countclick or any...when the user clicks the link to view.. before u add ++countclickand check wheather it is <=100 (if s process)else if no(blank or message page)
bronzestar at 2007-7-7 14:08:53 > top of Java-index,Archived Forums,Socket Programming...
# 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();

}

%>

silverstar at 2007-7-7 14:08:53 > top of Java-index,Archived Forums,Socket Programming...
# 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

bronzestar at 2007-7-7 14:08:53 > top of Java-index,Archived Forums,Socket Programming...
# 4
Hi sudheer,I think making use of SessionListener is a very good idea here.REGARDS,RAHUL
silverstar at 2007-7-7 14:08:53 > top of Java-index,Archived Forums,Socket Programming...