At 21:57 30.05.2002 -0700, [EMAIL PROTECTED] wrote:
[large snip]
>SocketWatchdog has a little more meat, but not much more. SocketWatchdog is
>configured with a port number. It creates a ServerSocket on the port and
>then watches it for connections. When a connection is made, the input
>stream is used as the source of the configuration data. Highlights:
>
>- setup() creates the ServerSocket. It sets an SoTimeout on it for 2
>seconds. This is an "automatic" timeout so the watchdog is not always
>locked up waiting for a connection and gets a chance to shutdown when told
>to.
>- cleanup() shuts down the ServerSocket.
>- checkForReconfiguration() calls the ServerSocket.accept() method. If a
>connection is made, the accepted Socket is stored in a member variable and
>will be used by the subsequent call to reconfigure(). If the ServerSocket
>is interupted by the 2 second SoTimeout, then it exits the method to give
>the base class a chance to check for shutdown.
>- reconfigure() is implemented to use the Socket member's input stream to
>reconfigure. It uses the base class method reconfigureByInputStream() to
>accomplish this.
>And that is it. One part I would like to point out is the use of
>reconfigureByInputStream(). In this case I think it is obvious that trying
>to reconfigure by a URL will not work. This is my argument for adding a
>reconfigure(InputStream) to the Configurator interface. I think a
>Configurator should be required to support both. If it can support a URL,
>it can certainly support an InputStream. Of course, I don't know what
>happens if you extend the source type to something else, like the new
>Preferences classes. Would we then need to support a
>reconfigure(Preferences)?
The reactionary in me is sill unmoved although the evidence is building up.
[snip]
>This concludes the Watchdog/Reconfigurator nickel tour. Please do not bump
>your heads on the way out and watch that first step. Comments are welcome
>as always. Once it looks like anyone that is going to comment has, I will
>clean up the code, apply the suggestions, and start checking code into cvs.
Good. Are you going to check in under o.a.log4j,config?
>We should discuss how the configuration/starting/stopping of watchdogs will
>be handled. All the watchdogs can have names, but the current set/single
>watchdog will need to be stored someplace. Where? The repository?
Here is an implementation of the WatchdogRegistry where watchdogs are stored.
public class WatchdogRegistry {
static private WatchdogRegistry watchdogRegistry = new WatchdogRegistry();
private Hashtable watchdogs;
public WatchdogRegistry() {
watchdogs = new Hashtable(5); // small table
}
public Watchdog getWatchdog(String name) {
return watchdogs.get(name);
}
public void putWatchdog(String key, Watchdog wdog) {
watchdogs.put(key, wdog);
}
static WatcdogRegisty getInstance() {
return watchdogRegistry;
}
}
I think watchdogs should know the LoggerRepository they should
configure which something missing in the current design.
Here is a config file messing with a watchdog:
log4j.watchdog.name= W1
log4j.watchdog.class=org.apache.log4j.config.HTTPWatchdog
log4j.watchdog.url=htpp://host/path/
log4j.watchdog.checkInterval=60000
log4j.watchdog.command=[start|stop]
log4j.rootLogger=....
A Configurator will not *reconfigure* an already running watchdog
except to change its check interval or to stop it. To change the
watchdog, you rename it.
I think watchdogs should know the LoggerRepository they should
configure which is something missing in the current Watchdog design.
Now that I think of it a bit more, I wonder if it is not better to go
the java.util.Timer route and view checks for file changes as
TimerTasks. This might not make sense until we start messing with time
sensitive appenders that send at most one email message per hour, one
SMS message per hour, etc. (SMS is a very popular messaging systems
for mobile phones based on the GSM technology.) Having a single point
for scheduling time sensitive events might prove to be very useful.
(It is not hard to rewrite java.util.Timer for JDK 1.1 or 1.2.)
Sorry for this revolutionary idea at the last minute,
>-Mark
--
Ceki
SUICIDE BOMBING - A CRIME AGAINST HUMANITY
Sign the petition: http://www.petitiononline.com/1234567b
I am signatory number 22106. What is your number?
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>