Class AppDaemonService
java.lang.Object
fr.paris.lutece.portal.service.daemon.AppDaemonService
this class provides methods to manage daemons services
-
Method Summary
Modifier and TypeMethodDescriptionstatic DaemonGets a daemon object from its key namestatic Collection<DaemonEntry>Get the current known DaemonEntries within the DaemonFactorystatic DaemonEntrygetDaemonEntry(String strDaemonKey) Get the DaemonEntry within the current known DaemonEntries within the DaemonFactorystatic voidinit()Performs initialization of the DaemonFactory.static booleanisDaemonRunning(String strDaemonKey) Tells whether a daemon is running, i.e. scheduled for execution.static booleanisValidCronExpression(String strDaemonCron) Validates a cron expression against the daemon schedulerstatic voidmodifyDaemonCron(String strDaemonKey, String strDaemonCron) Modify daemon cron expressionstatic voidmodifyDaemonInterval(String strDaemonKey, String strDaemonInterval) modify daemon intervalstatic voidregisterDaemon(DaemonEntry entry) Register a daemon by its entrystatic voidshutdown()Performs the shutdown of the DaemonFactory.static booleansignalDaemon(String strDaemonKey) Signal a daemon for execution in the immediate future.static booleansignalDaemon(String strDaemonKey, long nDelay, TimeUnit unit) Signal a daemon for execution in the immediate future.static voidstartDaemon(String strDaemonKey) Starts a daemonstatic voidstopDaemon(String strDaemonKey) Stops a daemonstatic voidunregisterDaemon(String strDaemonKey) Unregister a daemon
-
Method Details
-
init
public static void init()Performs initialization of the DaemonFactory. Note that this should return right away so that processing can continue (IE thread off everything)- Throws:
LuteceInitException- If an error occurred
-
registerDaemon
Register a daemon by its entry- Parameters:
entry- The daemon entry- Throws:
LuteceInitException- If an error occurred
-
unregisterDaemon
Unregister a daemon- Parameters:
strDaemonKey- The daemon key
-
startDaemon
Starts a daemon- Parameters:
strDaemonKey- The daemon key
-
stopDaemon
Stops a daemon- Parameters:
strDaemonKey- The daemon key
-
isDaemonRunning
Tells whether a daemon is running, i.e. scheduled for execution.- Parameters:
strDaemonKey- The daemon key- Returns:
trueif the daemon is registered and scheduled,falseotherwise
-
signalDaemon
Signal a daemon for execution in the immediate future.This can fail is resources are limited, which should be exceptional.
- Parameters:
strDaemonKey- the daemon key- Returns:
trueif the daemon was successfully signaled,falseotherwise- Since:
- 6.0.0
-
signalDaemon
Signal a daemon for execution in the immediate future.This can fail is resources are limited, which should be exceptional.
- Parameters:
strDaemonKey- the daemon keynDelay- the delay before executionunit- the unit ofnDelayargument- Returns:
trueif the daemon was successfully signaled,falseotherwise- Since:
- 6.0.0
-
modifyDaemonInterval
modify daemon interval- Parameters:
strDaemonKey- The daemon keystrDaemonInterval- the daemon interval
-
modifyDaemonCron
Modify daemon cron expression- Parameters:
strDaemonKey- The daemon keystrDaemonCron- The daemon cron expression
-
getDaemonEntries
Get the current known DaemonEntries within the DaemonFactory- Returns:
- the entries list of daemons declaration
-
getDaemonEntry
Get the DaemonEntry within the current known DaemonEntries within the DaemonFactory- Parameters:
strDaemonKey- The daemon key- Returns:
- the corresponding DaemonEntry
-
shutdown
public static void shutdown()Performs the shutdown of the DaemonFactory. -
getDaemon
Gets a daemon object from its key name- Parameters:
strDaemonKey- The daemon key- Returns:
- The daemon
-
isValidCronExpression
Validates a cron expression against the daemon scheduler- Parameters:
strDaemonCron- The cron expression to validate- Returns:
- True if the expression is valid
-