edu.internet2.middleware.grouper.util
Class GrouperFuture<T>
java.lang.Object
edu.internet2.middleware.grouper.util.GrouperFuture<T>
- Type Parameters:
T
- type of return
- All Implemented Interfaces:
- java.util.concurrent.Future<T>
public class GrouperFuture<T>
- extends java.lang.Object
- implements java.util.concurrent.Future<T>
like a normal future but keeps a reference to the callable,
and exceptions are wrapped in RuntimeException
Constructor Summary |
GrouperFuture(java.util.concurrent.Future theFuture,
java.util.concurrent.Callable theCallable)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GrouperFuture
public GrouperFuture(java.util.concurrent.Future theFuture,
java.util.concurrent.Callable theCallable)
- Parameters:
theFuture
- theCallable
-
getCallable
public java.util.concurrent.Callable getCallable()
- Returns:
- the grouperCallable
getGrouperCallable
public GrouperCallable getGrouperCallable()
- if grouper callable, this is a convenience method for getting that type
- Returns:
- the grouperCallable
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface java.util.concurrent.Future<T>
- See Also:
Future.cancel(boolean)
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface java.util.concurrent.Future<T>
- See Also:
Future.isCancelled()
isDone
public boolean isDone()
- Specified by:
isDone
in interface java.util.concurrent.Future<T>
- See Also:
Future.isDone()
get
public T get()
- Specified by:
get
in interface java.util.concurrent.Future<T>
- See Also:
Future.get()
get
public T get(long timeout,
java.util.concurrent.TimeUnit unit)
- Specified by:
get
in interface java.util.concurrent.Future<T>
- See Also:
Future.get(long, java.util.concurrent.TimeUnit)
waitForJob
public static void waitForJob(java.util.List<GrouperFuture> futures,
int threadPoolSize,
java.util.List<GrouperCallable> callablesWithProblems)
- relies on the callable being a GrouperCallable. make sure there arent more threads than the max.
pass in 0 to wait for all.
- Parameters:
futures
- threadPoolSize
- callablesWithProblems
- pass in a list to capture which jobs had problems. if null, then jsut throw
exceptions as they happen