ActiveTaskModule¶
-
public class
ActiveTaskModule
extends ActiveModule¶ ActiveTaskModule is an active module which manages an active task list. As an active module, it runs as a separated thread and loops through the task list for executing the tasks. It also contains an active monitor responsible for monitoring and controlling the thread count.
Author: Hugo Y. K. Lam
Constructors¶
ActiveTaskModule¶
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, boolean shouldInitialize)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, ClassLoader loader)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
ActiveTaskModule¶
-
public
ActiveTaskModule
(String descriptorLocation, ClassLoader loader, boolean shouldInitialize)¶ Creates a new instance of ActiveTaskModule.
Parameters: - descriptorLocation – the module descriptor.
- loader – the class loader for this module.
- shouldInitialize – true if the module should be initialized.
Throws: - ModuleException – when errors encountered when loading the module descriptor.
Methods¶
execute¶
-
public boolean
execute
()¶ Invoked by the start() method to start executing the managed task list and its tasks.
Returns: true if the active monitor of this module is not suspended. See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.execute()
getMonitor¶
-
public ActiveMonitor
getMonitor
()¶ Gets the monitor of this module.
Returns: the monitor of this module.
init¶
-
public void
init
()¶ Initializes this module by loading the active task list component named “task-list”. The component may have the following parameters:
- max-thread-count: the maximum number of threads which can be acquired to execute the tasks in the task list. A number smaller than 1 indicates the tasks should be run under the same thread as this module.
- wait-for-list: true if the tasks in the task list should be completely executed before being refreshed.
onStart¶
-
public void
onStart
()¶ Resumes the active monitor so that new threads can be acquired for executing tasks.
See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.start()
,hk.hku.cecid.piazza.commons.module.ActiveModule.onStart()
onStop¶
-
public void
onStop
()¶ Suspends the active monitor so that no more threads can be acquired for executing tasks.
See also:
hk.hku.cecid.piazza.commons.module.ActiveModule.stop()
,hk.hku.cecid.piazza.commons.module.ActiveModule.onStop()