Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
SyncThread(CyclicBarrier b,
Callable<T> c)
Get a SyncThread that will call the given callable when the given barrier
allows it past.
|
Modifier and Type | Method and Description |
---|---|
static <T> Collection<SyncThread<T>> |
getCompletedThreads(int num,
Callable<T> callable)
Get a collection of SyncThreads that all began as close to the same time as
possible and have all completed.
|
static <T> int |
getDistinctResultCount(int num,
Callable<T> callable)
Get the distinct result count for the given callable at the given
concurrency.
|
T |
getResult()
Get the result from the invocation.
|
void |
run()
Wait for the barrier, invoke the callable and capture the result or an
exception.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public SyncThread(CyclicBarrier b, Callable<T> c)
b
- the barrierc
- the callablepublic void run()
public T getResult() throws Throwable
Throwable
- if an error occurred when evaluating the callablepublic static <T> Collection<SyncThread<T>> getCompletedThreads(int num, Callable<T> callable) throws InterruptedException
T
- the result type of the SyncThreadnum
- the number of concurrent threads to executecallable
- the thing to callInterruptedException
- if we're interrupted during joinpublic static <T> int getDistinctResultCount(int num, Callable<T> callable) throws Throwable
T
- the type of the callablenum
- the concurrencycallable
- the callable to invokeThrowable
- if an exception occurred in one of the invocationsCopyright © 2024. All rights reserved.