|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.claritysys.util.Daemon
public class Daemon
Provides an abstraction for daemon programs to detect when to shutdown.
It does this by monitoring for the presence of a file, whose path is specified as a configuration parameter. The file can optionally be deleted as the process terminates.
Configure by passing it a Properties
object with the following
properties defined:
Example:
Properties properties = new Properties (); properties.load (new FileInputStream ("myapp.properties")); Daemon daemon = new Daemon (properties); while (!daemon.isProcessEnding ()) { // Continue running! // Nothing to do? if (nothingToDo) { try {Thread.sleep (5000);} catch (Exception e) {} } }
Field Summary | |
---|---|
protected java.io.File |
shutdownFile
Field shutdownFile |
protected boolean |
shutdownFileAutoDelete
Field shutdownFileAutoDelete |
protected java.lang.String |
shutdownFileName
Our standard batch job control mechanism - shutdown files. |
Constructor Summary | |
---|---|
Daemon(java.util.Properties properties)
Create a new Daemon from properties. |
|
Daemon(java.lang.String shutdownFileName,
boolean autoDelete)
Create a new Daemon. |
Method Summary | |
---|---|
boolean |
isProcessEnding()
Return true if its time to shut down. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String shutdownFileName
protected boolean shutdownFileAutoDelete
protected java.io.File shutdownFile
Constructor Detail |
---|
public Daemon(java.lang.String shutdownFileName, boolean autoDelete)
shutdownFileName
- The path to the shutdown file.autoDelete
- If true, delete the file as we exit.public Daemon(java.util.Properties properties)
properties
- See the class javadoc for a description of the
properties that are read.Method Detail |
---|
public boolean isProcessEnding()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |