I would suggest Create a class which extends a Thread Class and you
populate your state information in run() method of this class. You can
configure this thread delay it by calling it's sleep method. In this way
time to time this thread will wake up and initialize the state data.
Have a flag in database which says you have changed the data so that
thread will call run() method each time but it will actually load the
data when it found a flag in database changed. Once you refresh  the
data next time, you can set this flag again back to unchanged state.

-Jaish

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED] On Behalf Of
Richard Yee
Sent: Wednesday, August 31, 2005 9:17 PM
To: SERVLET-INTEREST@JAVA.SUN.COM
Subject: Re: Global Data

Why don't you have an initialization servlet that is set to load on
startup and whose init method calls another method that actually loads
the state information and puts it in application scope. You can also
code the doGet() method of the servlet to call the initialization
method. Whenever you want to reinitialize the state info, you would
invoke the servlet. You might want to make sure there are no other users
on the site when the state information is refreshed so that users don't
access partially refreshed data.

-Richard

At 07:51 PM 8/31/2005, you wrote:
>Hi,
>I have a question.
>In my web application, when the user logs in, I have to load all State 
>information from the database and display it.The State information will

>be common to all users.I would add new States into the database table.
>My question is what is the best way to get the state information from 
>database and store it globally,so that, it can be shared by all users.
>
>If I use servlet for this, and load the state information in the 
>init(), I have to restart the server whenever I add new state 
>information to the database, inorder to get the new states.I don't want

>the server to get restarted whenever I add state information to 
>database.SO, this option is not feasible.
>Is there any other way to do this?
>
>Any ideas/suggestions to resolve this issue would be very helpful for
me.
>
>Thanks in advance.
>
>_______________________________________________________________________
>____ 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

________________________________________________________________________
___
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

___________________________________________________________________________
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