org.drools.concurrent
Class ExternalExecutorService.TaskManager

java.lang.Object
  extended by org.drools.concurrent.ExternalExecutorService.TaskManager
All Implemented Interfaces:
ExternalExecutorService.TaskObserver
Enclosing class:
ExternalExecutorService

protected static class ExternalExecutorService.TaskManager
extends Object
implements ExternalExecutorService.TaskObserver

An implementation of the TaskObserver interface that keeps a map of submitted, but not executed tasks. Whenever one of the ObservableTasks is executed, it is removed from the map.


Constructor Summary
ExternalExecutorService.TaskManager()
           
 
Method Summary
 void afterTaskFinishes(Callable<?> task, Thread thread)
           
 void afterTaskFinishes(Runnable task, Thread thread)
           
 void beforeTaskStarts(Callable<?> task, Thread thread)
           
 void beforeTaskStarts(Runnable task, Thread thread)
           
 void cleanUpTasks()
           
 void taskExceptionRaised(Runnable task, Thread thread, Throwable t)
           
<T> Callable<T>
trackTask(Callable<T> task)
          Creates an ObservableCallable instance for the given task and tracks the task execution
 Runnable trackTask(Runnable task)
          Creates an ObservableRunnable instance for the given task and tracks the task execution
 Collection trackTasks(Collection tasksToTrack)
          Creates an ObservableCallable instance for each of the given taks and track their execution
 void waitUntilEmpty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalExecutorService.TaskManager

public ExternalExecutorService.TaskManager()
Method Detail

waitUntilEmpty

public void waitUntilEmpty()

cleanUpTasks

public void cleanUpTasks()

trackTask

public Runnable trackTask(Runnable task)
Creates an ObservableRunnable instance for the given task and tracks the task execution

Parameters:
task - the task to track
Returns:
the observable instance of the given task

trackTask

public <T> Callable<T> trackTask(Callable<T> task)
Creates an ObservableCallable instance for the given task and tracks the task execution

Parameters:
task - the task to track
Returns:
the observable instance of the given task

trackTasks

public Collection trackTasks(Collection tasksToTrack)
Creates an ObservableCallable instance for each of the given taks and track their execution

Parameters:
tasksToTrack - the collection of tasks to track
Returns:
the collection of ObservableCallable tasks

afterTaskFinishes

public void afterTaskFinishes(Runnable task,
                              Thread thread)
Specified by:
afterTaskFinishes in interface ExternalExecutorService.TaskObserver

afterTaskFinishes

public void afterTaskFinishes(Callable<?> task,
                              Thread thread)
Specified by:
afterTaskFinishes in interface ExternalExecutorService.TaskObserver

beforeTaskStarts

public void beforeTaskStarts(Runnable task,
                             Thread thread)
Specified by:
beforeTaskStarts in interface ExternalExecutorService.TaskObserver

beforeTaskStarts

public void beforeTaskStarts(Callable<?> task,
                             Thread thread)
Specified by:
beforeTaskStarts in interface ExternalExecutorService.TaskObserver

taskExceptionRaised

public void taskExceptionRaised(Runnable task,
                                Thread thread,
                                Throwable t)
Specified by:
taskExceptionRaised in interface ExternalExecutorService.TaskObserver


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.