edu.internet2.middleware.grouper.util
Class GrouperFuture<T>

java.lang.Object
  extended by edu.internet2.middleware.grouper.util.GrouperFuture<T>
Type Parameters:
T - type of return
All Implemented Interfaces:
Future<T>

public class GrouperFuture<T>
extends Object
implements Future<T>

like a normal future but keeps a reference to the callable, and exceptions are wrapped in RuntimeException


Constructor Summary
GrouperFuture(Future theFuture, Callable theCallable)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 T get()
           
 T get(long timeout, TimeUnit unit)
           
 Callable getCallable()
           
 GrouperCallable getGrouperCallable()
          if grouper callable, this is a convenience method for getting that type
 boolean isCancelled()
           
 boolean isDone()
           
static void waitForJob(List<GrouperFuture> futures, int threadPoolSize, List<GrouperCallable> callablesWithProblems)
          relies on the callable being a GrouperCallable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrouperFuture

public GrouperFuture(Future theFuture,
                     Callable theCallable)
Parameters:
theFuture -
theCallable -
Method Detail

getCallable

public 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 Future<T>
See Also:
Future.cancel(boolean)

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<T>
See Also:
Future.isCancelled()

isDone

public boolean isDone()
Specified by:
isDone in interface Future<T>
See Also:
Future.isDone()

get

public T get()
Specified by:
get in interface Future<T>
See Also:
Future.get()

get

public T get(long timeout,
             TimeUnit unit)
Specified by:
get in interface Future<T>
See Also:
Future.get(long, java.util.concurrent.TimeUnit)

waitForJob

public static void waitForJob(List<GrouperFuture> futures,
                              int threadPoolSize,
                              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