org.openstreetmap.osmosis.core.pipeline.common
Class ActiveTaskManager

java.lang.Object
  extended by org.openstreetmap.osmosis.core.pipeline.common.TaskManager
      extended by org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager
Direct Known Subclasses:
ChangeSinkRunnableChangeSourceManager, ChangeSinkRunnableChangeSourceManager, MultiChangeSinkRunnableChangeSourceManager, MultiChangeSinkRunnableChangeSourceManager, MultiSinkMultiChangeSinkRunnableSourceManager, MultiSinkMultiChangeSinkRunnableSourceManager, MultiSinkRunnableChangeSourceManager, MultiSinkRunnableChangeSourceManager, MultiSinkRunnableSourceManager, MultiSinkRunnableSourceManager, RunnableChangeSourceManager, RunnableChangeSourceManager, RunnableDatasetSourceManager, RunnableDatasetSourceManager, RunnableSourceManager, RunnableSourceManager, RunnableTaskManager, SinkRunnableSourceManager, SinkRunnableSourceManager

public abstract class ActiveTaskManager
extends TaskManager

This task manager implementation supports tasks that perform active processing in a separate thread.

Author:
Brett Henderson

Constructor Summary
protected ActiveTaskManager(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> pipeArgs)
          Creates a new instance.
 
Method Summary
 void execute()
          Begins execution of the task.
protected abstract  java.lang.Runnable getTask()
          Returns the runnable task managed by this manager.
 boolean waitForCompletion()
          Waits until all tasks have completed execution before returning.
 
Methods inherited from class org.openstreetmap.osmosis.core.pipeline.common.TaskManager
connect, getInputTask, getTaskId, setOutputTask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveTaskManager

protected ActiveTaskManager(java.lang.String taskId,
                            java.util.Map<java.lang.String,java.lang.String> pipeArgs)
Creates a new instance.

Parameters:
taskId - A unique identifier for the task. This is used to produce meaningful errors when errors occur.
pipeArgs - The arguments defining input and output pipes for the task, pipes are a logical concept for identifying how the tasks are connected together.
Method Detail

getTask

protected abstract java.lang.Runnable getTask()
Returns the runnable task managed by this manager.

Returns:
The task.

execute

public void execute()
Begins execution of the task. For many sink tasks, this will not do anything. Source tasks are likely to begin execution within a new thread.

Specified by:
execute in class TaskManager

waitForCompletion

public boolean waitForCompletion()
Waits until all tasks have completed execution before returning. This is intended for source tasks that run within a separate thread, sink tasks will not do anything here.

Specified by:
waitForCompletion in class TaskManager
Returns:
True if the thread completed successfully.