W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2000

Re: Number of users logged

From: Brax <JBrax@csi.com>
Date: Fri, 3 Mar 2000 12:01:57 -0500 (EST)
Message-ID: <002501bf8531$703cfcc0$52838282@treso1082>
To: <walter@softplan.com.br>
Cc: <www-jigsaw@w3.org>
I've sended last month an example of servlet for accessing database; so here it is again.
Problems I've go is : 
- I'm not concerned about number of users ( history - but it's another story 
developped later ) but I'm rather concerned about concurrent access.
The idea developped in the source is to have a pool of database connection.
This servlet is called by other servlet retrieving parameters and passing it : 
      RequestDispatcher dispatch = getServletContext().getRequestDispatcher( SqlServlet + "?File=" + Mess1 + Mess2 + Mess4 );
      dispatch.include(req, res);

- So, servlet connecting to database process its pool of connection, execute statements
( sql orders are stored in files, with keywords for parameters ), and returns results.
- Meanwhile, if a user cancel it's query, servlet goes on ..., until finished. I do not 
process here DELETE messages. So, if the same TCP adress comes again, it gets 
the same database connection and waits until the first query finish ( bad, bad, bad ...).
- Source code is Serv3do3.java

Otherwise, for counting number of access, I use the MaintainedServlet ( from bibli ), 
that I picked somewhere. It works with ServletMaintenance, and for storing value, I use 
TextCounter and TextCounterDatabase. All of those were developped by Matt Tucker, 
at CoolServlets.com - I modified for my own needs - have a look there, they might have
some more good ideas. My servlet using those is called CSTextCounter, once more called by
another servlet, and once more modified for internationalization.

Have fun - j Brax







Received on Friday, 3 March 2000 12:05:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:06 UTC