org.jvnet.hk2.component.concurrent
Class WorkManager
java.lang.Object
org.jvnet.hk2.component.concurrent.WorkManager
- All Implemented Interfaces:
- Executor
public class WorkManager
- extends Object
- implements Executor
Simple helper for managing work sent to a foreign executor service.
Has similarities to Fork and Join.
The implementation is designed such that Tasks-1 are sent to the executor
service for possibly another thread to handle. The last task is executed
by the caller thread so that all threads are attempted to be fully utilized
for processing including the caller's thread.
- Author:
- Jeff Trent
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WorkManager
public WorkManager(Executor exec)
WorkManager
public WorkManager(Executor exec,
int tasksToDo)
getWorkInProgressCount
public int getWorkInProgressCount()
awaitCompletion
public void awaitCompletion()
awaitCompletion
public void awaitCompletion(long timeout,
TimeUnit unit)
throws TimeoutException
- Throws:
TimeoutException
completed
protected void completed(org.jvnet.hk2.component.concurrent.WorkManager.Watcher<?> watcher,
Exception e)
submitAll
public <V> Collection<Future<V>> submitAll(Collection<Callable<V>> tasks)
executeAll
public void executeAll(Collection<Runnable> tasks)
submit
public <V> Future<V> submit(Callable<V> task)
execute
public void execute(Runnable task)
- Specified by:
execute in interface Executor
Copyright © 2011 Oracle Corporation. All Rights Reserved.