|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
net.spy.memcached.compat.SpyThread
net.spy.memcached.compat.SyncThread<T>
public class SyncThread<T>
Thread that invokes a callable multiple times concurrently.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SyncThread(java.util.concurrent.CyclicBarrier b,
java.util.concurrent.Callable<T> c)
Get a SyncThread that will call the given callable when the given barrier allows it past. |
Method Summary | ||
---|---|---|
static
|
getCompletedThreads(int num,
java.util.concurrent.Callable<T> callable)
Get a collection of SyncThreads that all began as close to the same time as possible and have all completed. |
|
static
|
getDistinctResultCount(int num,
java.util.concurrent.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. |
Methods inherited from class net.spy.memcached.compat.SpyThread |
---|
getLogger |
Methods inherited from class java.lang.Thread |
---|
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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SyncThread(java.util.concurrent.CyclicBarrier b, java.util.concurrent.Callable<T> c)
b
- the barrierc
- the callableMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public T getResult() throws java.lang.Throwable
java.lang.Throwable
- if an error occurred when evaluating the callablepublic static <T> java.util.Collection<SyncThread<T>> getCompletedThreads(int num, java.util.concurrent.Callable<T> callable) throws java.lang.InterruptedException
T
- the result type of the SyncThreadnum
- the number of concurrent threads to executecallable
- the thing to call
java.lang.InterruptedException
- if we're interrupted during joinpublic static <T> int getDistinctResultCount(int num, java.util.concurrent.Callable<T> callable) throws java.lang.Throwable
T
- the type of the callablenum
- the concurrencycallable
- the callable to invoke
java.lang.Throwable
- if an exception occurred in one of the invocations
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |