Class ThreadEx<V>

java.lang.Object
java.lang.Thread
com.pnfsoftware.jeb.util.concurrent.ThreadEx<V>
Type Parameters:
V - computation result type
All Implemented Interfaces:
Runnable

public final class ThreadEx<V> extends Thread
An extension of Thread supporting the execution of Callable as well as Runnable. Two additional get() and get(timeout) methods, not unlike Future's get(), allow querying and waiting for the execution result. When executing a Runnable, get() will always return null. An exception occurring during the execution of the thread is collected and re-thrown inside an ExecutionException object.
  • Constructor Details

    • ThreadEx

      public ThreadEx(Runnable runnable)
      Create a thread that executes a runnable.
      Parameters:
      runnable - non-null runnable to execute
    • ThreadEx

      public ThreadEx(Callable<V> callable)
      Create a thread that executes a callable.
      Parameters:
      callable - non-null callable to execute
  • Method Details