Class ExecutionGroup
- java.lang.Object
-
- com.complexible.common.util.concurrent.ExecutionGroup
-
public abstract class ExecutionGroup extends java.lang.Object
A very light-weight utility class to make it easier to run a set of tasks together and wait until all those jobs end. The tasks can be run concurrently or sequentially depending on what kind of group has been created.- Since:
- 0.9
- Version:
- 2.0
- Author:
- Evren Sirin, Michael Grove
-
-
Constructor Summary
Constructors Constructor Description ExecutionGroup()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ExecutionGroup
add(java.util.concurrent.Callable<?> theTask)
ExecutionGroup
addAll(java.lang.Iterable<java.util.concurrent.Callable<?>> theTasks)
ExecutionGroup
addAll(java.util.Iterator<java.util.concurrent.Callable<?>> theTasks)
static ExecutionGroup
concurrent(java.util.concurrent.ExecutorService theExecutorService)
abstract java.lang.Iterable<java.util.concurrent.Future<?>>
execute()
abstract void
executeAndWait()
abstract boolean
isExecuting()
protected abstract void
performAdd(java.util.concurrent.Callable<?> theTask)
static ExecutionGroup
sequential()
-
-
-
Method Detail
-
add
public ExecutionGroup add(java.util.concurrent.Callable<?> theTask)
-
addAll
public ExecutionGroup addAll(java.util.Iterator<java.util.concurrent.Callable<?>> theTasks)
-
addAll
public ExecutionGroup addAll(java.lang.Iterable<java.util.concurrent.Callable<?>> theTasks)
-
performAdd
protected abstract void performAdd(java.util.concurrent.Callable<?> theTask)
-
executeAndWait
public abstract void executeAndWait() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException
-
execute
public abstract java.lang.Iterable<java.util.concurrent.Future<?>> execute() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
- Throws:
java.util.concurrent.ExecutionException
java.lang.InterruptedException
-
isExecuting
public abstract boolean isExecuting()
-
concurrent
public static ExecutionGroup concurrent(java.util.concurrent.ExecutorService theExecutorService)
-
sequential
public static ExecutionGroup sequential()
-
-