Class GrouperFuture<T>

java.lang.Object
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 Details

    • GrouperFuture

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

    • 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:
    • isCancelled

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

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

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

      public T get(long timeout, TimeUnit unit)
      Specified by:
      get in interface Future<T>
      See Also:
    • waitForJob

      public static boolean waitForJob(GrouperFuture<?> future, int secondsToWait)
      Parameters:
      future -
      secondsToWait - -1 to wait forever
      Returns:
      true if done, false if not (can also call future.isDone(), and future.get())
    • 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