Be careful there. Refreshing config data means writting information while you
may read it at same time. So you might end up reading half baked,
thus inconsistent stuff.
This is definitely readers/writers problem (e.g. Tanenbaum's "Operating
Systems"). It can be solved using an algorithm presented there.
What worries me is what happens if a client dies and never
unlocks config data.
That is why I asked if there is something in servlets that makes
sure that all requests (readers) are through before the admin
servlet reloads data.
Dragomir
----------
From: Bart Cassady[SMTP:[EMAIL PROTECTED]]
Sent: Thursday, October 28, 1999 05:01 PM
To: [EMAIL PROTECTED]
Subject: Re: refreshing servlet's data
I'm also looking at doing something similiar. I want the administrator of the system
to be
able to change parts of the setup of the system without downing everything.
I'm looking at setting up an admin servlet that presents the settings to the
administrator
via HTML and allows the admin to insert/delete/update.
The servlet that holds the configuration of the system will:
- read the configuration from a database upon startup
- handle requests to get the configuration from both the admin servlet and other
servlets
- handle requests to update the configuration from the admin servlet. Here the
config
servlet will have the responsibility to update both it's cached version and the
database
So, to summarize, I intend to have a configuration caching servlet, an admin servlet,
and other
system servlets that implement the rest of the system.
Of course, this is just a gleam in my eye right now... I'd appreciate any comments on
this before
I write code.
Bart Cassady
Database Analyst
Associated Engineering Group Ltd.
[EMAIL PROTECTED]
>>> "Steven J. Owens" <[EMAIL PROTECTED]> 10/27 5:22 PM >>>
Dragomir asks:
> Currently, when I change data, I restart the server and initialize
> Globals in init method. Is there anything more intelligent? How I
> can make sure that all requests in all servlets are completed so I
> can call public static synchronized void initialize(0 in Globals. I
> need to make sure that all requests left their doPost/doGet.
I'm told some servlet engines will allow you to dynamically poke
them and get them to reload things, and that yet others will
automatically reload the servlet when the file changes.
I'm running into this same issue (we're using NES with Jrun) and
I've been writing my servlets so that if you invoke them with an
optional argument, they reload their config data. This isn't great,
but it's better than bouncing the server every time I need to tweak a
config variable.
One thing I've been considering is putting all of the config info
in a separate class and using some flavor of interservlet
communication. Then I could just poke the special config class (or
maybe a config servlet) to reload the config data for all of the
servlets. I'd be interested in hearing what approaches others have
used, particularly with servlet engines that don't provide a solution.
Steven J. Owens
[EMAIL PROTECTED]
[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
___________________________________________________________________________
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