|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectBeforeAfterCaller<ValueT>
ValueT - the type of the Future
returned by submit().public class BeforeAfterCaller<ValueT>
Call the methods of a BeforeAfterCallable using an Executor.
Uses a CyclicBarrier to synchronize the submitting thread
with the worker thread
when the chosen Executor uses a different thread.
| Field Summary | |
|---|---|
static int |
DEFAULT_TIMEOUT
Milliseconds to wait before the CyclicBarrier times out:
60000 milliseconds. |
| Constructor Summary | |
|---|---|
BeforeAfterCaller()
Create with a simple Executor
that creates a separate worker thread. |
|
BeforeAfterCaller(Executor executor)
Create with the given Executor. |
|
BeforeAfterCaller(Executor executor,
int timeoutMs)
Create with the given Executor. |
|
| Method Summary | |
|---|---|
Executor |
getExecutor()
Returns the Executor. |
BeforeAfterFutureTask<ValueT> |
submit(BeforeAfterCallable<ValueT> task)
Submit the BeforeAfterCallable to be executed
by the Executor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_TIMEOUT
CyclicBarrier times out:
60000 milliseconds.
| Constructor Detail |
|---|
public BeforeAfterCaller()
Executor
that creates a separate worker thread.
public BeforeAfterCaller(Executor executor)
Executor.
executor - Executor
public BeforeAfterCaller(Executor executor,
int timeoutMs)
Executor.
executor - ExecutortimeoutMs - how long to wait for submitting thread and worker thread
to synchronize| Method Detail |
|---|
public BeforeAfterFutureTask<ValueT> submit(BeforeAfterCallable<ValueT> task)
throws Exception
BeforeAfterCallable to be executed
by the Executor.
Multiple calls to submit() can execute concurrently.
Throws an Error
if proceed() was not called
by the time before() returns.
Throws an Exception if there was a problem coordinating
with the worker thread; such an exception has as its cause
the Exception thrown by CyclicBarrier.
task - what to run
Exception - or Errorpublic Executor getExecutor()
Executor.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||