org.openmrs.scheduler.tasks
Class TaskThreadedInitializationWrapper

java.lang.Object
  extended by org.openmrs.scheduler.tasks.TaskThreadedInitializationWrapper
All Implemented Interfaces:
Task

public class TaskThreadedInitializationWrapper
extends java.lang.Object
implements Task

This class executes the Task.initialize method in a new thread. Extend this class if you want your initialize(TaskDefinition) method to run in a new thread (and hence not hold up the "startup" processes)


Constructor Summary
TaskThreadedInitializationWrapper(Task task)
          Default constructor to create this wrapper
 
Method Summary
 void execute()
          Executes the task defined in the task definition.
 TaskDefinition getTaskDefinition()
          Returns the task definition associated with this task.
 void initialize(TaskDefinition config)
          Initializes the task and sets the task definition.
 boolean isExecuting()
          Returns true if the task is currently in its execute() method.
 void shutdown()
          Callback method used to clean up resources used during the tasks execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskThreadedInitializationWrapper

public TaskThreadedInitializationWrapper(Task task)
Default constructor to create this wrapper

Parameters:
task - the Task to wrap around
Method Detail

execute

public void execute()
Description copied from interface: Task
Executes the task defined in the task definition.

Specified by:
execute in interface Task
Throws:
java.lang.InterruptedException
See Also:
Executes the task defined in the task definition but waits until the initialize method has finished

initialize

public void initialize(TaskDefinition config)
Description copied from interface: Task
Initializes the task and sets the task definition.

Specified by:
initialize in interface Task
See Also:
Initializes the task and sets the task definition. This method is non-blocking by executing in a new thread.

getTaskDefinition

public TaskDefinition getTaskDefinition()
Description copied from interface: Task
Returns the task definition associated with this task.

Specified by:
getTaskDefinition in interface Task
Returns:
a task definition
See Also:
Task.getTaskDefinition()

isExecuting

public boolean isExecuting()
Description copied from interface: Task
Returns true if the task is currently in its execute() method.

Specified by:
isExecuting in interface Task
Returns:
true if task is executing, false otherwise
See Also:
Task.isExecuting()

shutdown

public void shutdown()
Description copied from interface: Task
Callback method used to clean up resources used during the tasks execution.

Specified by:
shutdown in interface Task
See Also:
Task.shutdown()

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change