Hi,

one approach may be to setup a caching of the resultset - let me
explain:
-build yourself a wrapper class for your holding the data of one row in
your set.

-when the resultset is first requested, instanciate one object for each
row and put it into
for example a hashtable (so, here is your single copy set)

-rewrite your existing servlet to operate directly on the hashtable,
that means all inserts, updates must be rewritten to insert or update
the corresponding object in the hashtable. this in turn (or better the
class which contains your hashtable) can choose different strategies to
update its objects to the database. one approach is to update the
database every time an  object has been changed in your hashtable -
another would be a daemon, which updates the tables after a specific
period of time.

but be aware that the operations on the hashtable maybe have to be
synchronized if the same objects could be accessed by different users.

there's another issue with your approach below. a resultset is not meant
to hold data over a longer period of time. after you've read all data
from the resultset, it is not garanteed to the valid any more (the same
as with enumerations). at least this is true for jdbc 1.x i think.

hope this helps

joern

pradeep wrote:
>
> Hi All
>
> I would like to take ur help in solving this design related problem :
>
> I have to design a system which enables accepting the applications online
> and processing them
> in the back end by staff people. First , I am storing all the coming
> requests into a database using
> Java Servlets. Now I want to show these requests to staff people as a list
> on the browser.
> I am thinking of implementing this also in Java servlets. The number of
> incoming requests per day is
> around 100. Thus with in a week time , the total number of records are
> reaching thousands.
>
> Here is the point on which I want the clarification:
>
> 1.In my servlet , I don't want to access the database and create the list on
> each request. This will
> hit the performance, I will be having duplicate result sets(Number depends
> on the number of staff people) in the memory. What I want to have is a
> "single updated result set " shared by all the staff people.
> This could be done probably by declaring the "result set" as instance
> variable. But How can I keep this "result set" updated without processing it
> in the "service" method.The probable solution could be there should be a
> "Daemon thread"(seperate from the http threads) which shall be accessing the
> database in regular intervals and keep updating the "single result set".Is
> this correct solution to implement?will it not hit the performance, which is
> already running many "http" threads?
>
> 2.Also I have the interface which allows the  staff to view the lists,based
> on 2 options :
>  option 1) Time - past 10 days, 20 days, 1 month, all
>  option 2) Number of rows per page - 20,40,60,80,100,
>
> I think  If I can have a "single result set"(kept updated out of the
> "service" method), then I can
> put my page display logic in the service() method...
>
> I would appreciate if anybody could give me hints in clearing my doubts....
>
> thanks & regards,
> -pradeep
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

--
----------------
Joern Turner
inTouch GmbH
Kaiserin-Augusta-Allee 101, 10553 Berlin
Tel: 030 / 34 90 97 23
Fax: 030 / 34 90 97 25
[EMAIL PROTECTED]
----------------

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to