java.lang.Object |
↳ |
java.lang.Thread |
|
↳ |
com.pnfsoftware.jeb.util.concurrent.ThreadEx<V> |
Class Overview
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.
Summary
[Expand]
Inherited Constants |
From class
java.lang.Thread
int |
MAX_PRIORITY |
|
int |
MIN_PRIORITY |
|
int |
NORM_PRIORITY |
|
|
Public Methods |
V
|
get(long millis)
Waits if necessary for at most the given time for the computation to complete, and then
retrieves its result, if available.
|
V
|
get()
Waits if necessary for the computation to complete, and then retrieves its result.
|
final
void
|
run()
|
[Expand]
Inherited Methods |
From class
java.lang.Thread
static
int
|
activeCount()
|
final
void
|
checkAccess()
|
Object
|
clone()
|
int
|
countStackFrames()
|
static
Thread
|
currentThread()
|
static
void
|
dumpStack()
|
static
int
|
enumerate(Thread[] arg0)
|
static
Map<Thread, StackTraceElement[]>
|
getAllStackTraces()
|
ClassLoader
|
getContextClassLoader()
|
static
Thread.UncaughtExceptionHandler
|
getDefaultUncaughtExceptionHandler()
|
long
|
getId()
|
final
String
|
getName()
|
final
int
|
getPriority()
|
StackTraceElement[]
|
getStackTrace()
|
Thread.State
|
getState()
|
final
ThreadGroup
|
getThreadGroup()
|
Thread.UncaughtExceptionHandler
|
getUncaughtExceptionHandler()
|
static
boolean
|
holdsLock(Object arg0)
|
void
|
interrupt()
|
static
boolean
|
interrupted()
|
final
boolean
|
isAlive()
|
final
boolean
|
isDaemon()
|
boolean
|
isInterrupted()
|
final
void
|
join()
|
synchronized
final
void
|
join(long arg0)
|
synchronized
final
void
|
join(long arg0, int arg1)
|
static
void
|
onSpinWait()
|
final
void
|
resume()
|
void
|
run()
|
void
|
setContextClassLoader(ClassLoader arg0)
|
final
void
|
setDaemon(boolean arg0)
|
static
void
|
setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler arg0)
|
synchronized
final
void
|
setName(String arg0)
|
final
void
|
setPriority(int arg0)
|
void
|
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler arg0)
|
static
void
|
sleep(long arg0, int arg1)
|
static
void
|
sleep(long arg0)
|
synchronized
void
|
start()
|
final
void
|
stop()
|
final
void
|
suspend()
|
String
|
toString()
|
static
void
|
yield()
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
java.lang.Runnable
|
Public Constructors
public
ThreadEx
(Runnable runnable)
public
ThreadEx
(Callable<V> callable)
Public Methods
public
V
get
(long millis)
Waits if necessary for at most the given time for the computation to complete, and then
retrieves its result, if available.
Parameters
millis |
the maximum time to wait, in milliseconds; 0 means wait forever |
Returns
- the computed result; always null for a Runnable
Throws
ExecutionException
| if the computation threw an exception |
InterruptedException
| if the current thread was interrupted while waiting |
TimeoutException
| if the wait timed out
|
public
V
get
()
Waits if necessary for the computation to complete, and then retrieves its result.
Returns
- the computed result; always null for a Runnable
Throws
ExecutionException
| if the computation threw an exception |
InterruptedException
| if the current thread was interrupted while waiting
|