Package hec.io
Class PeriodicLogger
java.lang.Object
java.util.TimerTask
hec.io.PeriodicLogger
- All Implemented Interfaces:
Runnable
A scheduled logger that will log every 15 minutes.
To set the message, define the property PeriodicLogger.message
(for example,
-DPeriodicLogger.message="some message here"
)-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
Log a message.static PeriodicLogger
runAtFixedRate
(boolean isDaemon) Create a periodic logger and schedule it to run every 15 minutes starting at the nearest 15 minute interval.void
shutdown()
Shutdown the executor service and stop logging messagesMethods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
RUN_PROPERTY
- See Also:
-
MESSAGE_PROPERTY
The property for the message to log- See Also:
-
-
Method Details
-
run
public void run()Log a message. This is intended to only be called by the periodic executor service. -
shutdown
public void shutdown()Shutdown the executor service and stop logging messages -
runAtFixedRate
Create a periodic logger and schedule it to run every 15 minutes starting at the nearest 15 minute interval. If this method is run at 10:07 am, the logger will first run at 10:15 am, then 10:30 am, etc until eithershutdown()
is called on the returned PeriodicLogger or the JVM shuts down (if isDaemon is true)- Parameters:
isDaemon
- true if the executor service should create a daemon thread. If true, the executor service will not keep the JVM running. If false, the executor service will keep the JVM running, even if all other threads have terminated. It should not, however, keep the JVM running afterSystem.exit(int)
is called.- Returns:
- A periodic logger that will run every 15 minutes.
-