public class AsyncInvocation extends Thread
An AsyncInvocation represents the invocation of a
remote invocation that executes asynchronously from its caller. An
instanceof AsyncInvocation provides information about
the invocation such as any exception that it may have thrown.
Because it is a Thread, an
AsyncInvocation can be used as follows:
AsyncInvocation ai1 = vm.invokeAsync(Test.class, "method1");
AsyncInvocation ai2 = vm.invokeAsync(Test.class, "method2");
ai1.join();
ai2.join();
assertTrue("Exception occurred while invoking " + ai1,
!ai1.exceptionOccurred());
if (ai2.exceptionOccurred()) {
throw ai2.getException();
}
VM.invokeAsync(Class, String)Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
protected Throwable |
exception
An exception thrown while this async invocation ran
|
Object |
returnedObj
The returned object if any
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
AsyncInvocation(Object receiver,
String methodName,
Runnable work)
Creates a new
AsyncInvocation |
| Modifier and Type | Method and Description |
|---|---|
boolean |
exceptionOccurred()
Returns whether or not an exception occurred during this async
method invocation.
|
Throwable |
getException()
Returns the exception that was thrown during this async method
invocation.
|
String |
getMethodName()
Returns the name of the method being invoked remotely
|
Object |
getReceiver()
Returns the receiver of this async method invocation
|
Object |
getResult() |
Object |
getResult(long waitTime) |
Object |
getReturnValue() |
void |
run() |
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, yieldprotected volatile Throwable exception
public volatile Object returnedObj
public Object getReceiver()
public String getMethodName()
public boolean exceptionOccurred()
public Throwable getException()
public Object getReturnValue()
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.