Controlling Daemon Execution

The AdministrationService provides the following options to handle daemons:

Please refer to the section AdministrationService of the chapter Infinity Process Platform Services for information on this service or the according Javadoc of the AdministrationService for detailed information on its methods and their parameter usage.

Retrieving a Specified Daemon

To retrieve information on a daemon with a specified daemon type, use the method getDaemon:

Daemon getDaemon(String daemonType, boolean acknowledge)
    throws ObjectNotFoundException;

The following daemon types are provided:

The parameter acknowledge determines whether the daemon information should be acknowledged. If no daemon with the specified type is found, an ObjectNotFoundException is thrown.

Starting a Daemon

To start a daemon with a specified daemon type, use the method startDaemon:

Daemon startDaemon(String daemonType, boolean acknowledge)
    throws ObjectNotFoundException;

The parameter acknowledge determines whether the start operation should be acknowledged. If started with acknowledgment, then each new request first checks that previous requests have been acknowledged and are not still in response-requested state. When started without acknowledgment, these checks will not be made.

If no daemon with the specified type is found, an ObjectNotFoundException is thrown.

Note that the start daemon operation is inherently asynchronous, regardless of the acknowledge flag. The start operation schedules a timer for the daemon execution which will be performed asynchronously. If the acknowledge parameter is set to true then the method will wait for a predetermined (configurable) amount of time for the asynchronous daemon to confirm the execution of the operation. If acknowledge is false then the method will return immediately, without status updates to the returned object. Otherwise it will wait for the executor thread to confirm the action. The acknowledge flag allows to wait for the executor to confirm the actual start of the daemon. The status object is not influenced by this flag.

Stopping a Daemon

To stop a daemon with a specified daemon type, use the method stopDaemon:

Daemon stopDaemon(String daemonType, boolean acknowledge)
    throws ObjectNotFoundException;

The parameter acknowledge determines whether the stop operation should be acknowledged. If no daemon with the specified type is found, an ObjectNotFoundException is thrown.

Note that the stop daemon operation is inherently asynchronous, regardless of the acknowledge flag. The stop operation only marks the daemon for stopping. The daemon will stop asynchronously at the first opportunity. If the acknowledge parameter is set to true, the method will wait for a predetermined (configurable) amount of time for the asynchronous daemon to confirm the execution of the operation. If acknowledge is false then the method will return immediately, without status updates to the returned object. Otherwise it will wait for the executor thread to confirm the action. The acknowledge flag allows to wait for the executor to confirm the actual stop of the daemon. The status object is not influenced by this flag.

Retrieving a List of All Available Daemons

To retrieve a list of all the available daemons, use the method getAllDeamons:

List<Daemon> getAllDaemons(boolean acknowledge) throws AccessForbiddenException;

This method returns a list with the available Daemon objects. The parameter acknowledge determines whether the daemon information should be acknowledged. If you have no permission to manage daemons, an AccessForbiddenException is thrown.

Partition-aware Event Daemon Operations

Each operation applied with a partition-aware service factory is supposed to only consider the partition for which the service factory has been instantiated for. For example, if you use

administrationService.stopDaemon("event.daemon", false);

the daemon is stopped for the associated partition only.

You can view state changes per partition in the daemon_log table, which also contains a partition discriminator column. You see two entries per partition and per daemon type (event daemon, timer trigger, mail trigger). The entries, however, are only available if the daemon was started at least one time. Section Analyzing DAEMON_LOG Table Entries of chapter The Repository Model provides details on how to analyze these entries.

Avoiding Timeouts when using the Benchmark Daemon

Timeouts when you are using the Benchmark daemon might happen due to low batch size values. In that case increase the timeout value of the daemon queue via the property benchmark.daemon.BatchSize in your server-side carnot.properties file.

Additionally make sure that the default transaction timeout for your Daemon queue is at least equal to the value of property benchmark.daemon.Periodicity.

Please find details on properties benchmark.daemon.Periodicity and benchmark.daemon.BatchSize in section Daemon of chapter Server Side Properties.