public class VM
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
VM(Host host,
int pid,
RemoteDUnitVMIF client)
Creates a new
VM that runs on a given host with a
given process id. |
| Modifier and Type | Method and Description |
|---|---|
void |
bounce()
Synchronously bounces (mean kills and restarts) this
VM. |
static int |
getCurrentVMNum() |
Host |
getHost()
Returns the host on which this
VM runs |
int |
getPid()
Returns the process id of this
VM |
java.io.File |
getWorkingDirectory() |
java.lang.Object |
invoke(java.util.concurrent.Callable c)
Invokes the
run method of a Runnable in this
VM. |
java.lang.Object |
invoke(java.lang.Class c,
java.lang.String methodName)
Invokes a static zero-arg method with an
Object or
void return type in this VM. |
java.lang.Object |
invoke(java.lang.Class c,
java.lang.String methodName,
java.lang.Object arg)
Invokes a static method with an
Object or
void return type in this VM. |
java.lang.Object |
invoke(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with an
Object or
void return type in this VM. |
java.lang.Object |
invoke(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method with no arguments on an object that is
serialized into this VM.
|
java.lang.Object |
invoke(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
void |
invoke(java.lang.Runnable r)
Invokes the
run method of a Runnable in this
VM. |
AsyncInvocation |
invokeAsync(java.util.concurrent.Callable c)
Invokes the
call method of a Runnable in this
VM. |
AsyncInvocation |
invokeAsync(java.lang.Class c,
java.lang.String methodName)
Asynchronously invokes a static zero-arg method with an
Object or void return type in this VM. |
AsyncInvocation |
invokeAsync(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Asynchronously invokes a static method with an
Object or
void return type in this VM. |
AsyncInvocation |
invokeAsync(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Asynchronously invokes an instance method with an
Object or
void return type in this VM. |
AsyncInvocation |
invokeAsync(java.lang.Runnable r)
Invokes the
run method of a Runnable in this
VM. |
boolean |
invokeBoolean(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
boolean return type
in this VM. |
boolean |
invokeBoolean(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
boolean return type
in this VM. |
boolean |
invokeBoolean(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
boolean |
invokeBoolean(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
byte |
invokeByte(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
byte return type
in this VM. |
byte |
invokeByte(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
byte return type
in this VM. |
byte |
invokeByte(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
byte |
invokeByte(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
char |
invokeChar(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
char return type
in this VM. |
char |
invokeChar(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
char return type
in this VM. |
char |
invokeChar(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
char |
invokeChar(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
double |
invokeDouble(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
double return type
in this VM. |
double |
invokeDouble(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
double return type
in this VM. |
double |
invokeDouble(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
double |
invokeDouble(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
float |
invokeFloat(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
float return type
in this VM. |
float |
invokeFloat(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
float return type
in this VM. |
float |
invokeFloat(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
float |
invokeFloat(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
int |
invokeInt(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
int return type
in this VM. |
int |
invokeInt(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
int return type
in this VM. |
int |
invokeInt(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
int |
invokeInt(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
long |
invokeLong(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
long return type
in this VM. |
long |
invokeLong(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
long return type
in this VM. |
long |
invokeLong(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
long |
invokeLong(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
void |
invokeMain(java.lang.Class c,
java.lang.String[] args)
Invokes the
main method of a given class |
AsyncInvocation |
invokeMainAsync(java.lang.Class c,
java.lang.String[] args)
Asynchronously invokes the
main method of a given
class |
void |
invokeRepeatingIfNecessary(RepeatableRunnable o,
long repeatTimeoutMs)
Invokes the
runRunnable in this
VM. |
short |
invokeShort(java.lang.Class c,
java.lang.String methodName)
Invokes a static method with a
short return type
in this VM. |
short |
invokeShort(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Invokes a static method with a
short return type
in this VM. |
short |
invokeShort(java.lang.Object o,
java.lang.String methodName)
Invokes an instance method on an object that is serialized into
this VM.
|
short |
invokeShort(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Invokes an instance method on an object that is serialized into
this VM.
|
java.lang.String |
toString() |
public VM(Host host, int pid, RemoteDUnitVMIF client)
VM that runs on a given host with a
given process id.public Host getHost()
VM runspublic int getPid()
VMpublic java.lang.Object invoke(java.lang.Class c,
java.lang.String methodName)
Object or
void return type in this VM. If the return type of
the method is void, null is returned.c - The class on which to invoke the methodmethodName - The name of the method to invokeRMIException - An exception occurred on while invoking the method in
this VMpublic AsyncInvocation invokeAsync(java.lang.Class c, java.lang.String methodName)
Object or void return type in this VM. If the
return type of the method is void, null
is returned.c - The class on which to invoke the methodmethodName - The name of the method to invokepublic java.lang.Object invoke(java.lang.Class c,
java.lang.String methodName,
java.lang.Object arg)
Object or
void return type in this VM. If the return type of
the method is void, null is returned.c - The class on which to invoke the methodmethodName - The name of the method to invokearg - Single argument passed to the method call (must be Serializable).RMIException - An exception occurred on while invoking the method in
this VMpublic java.lang.Object invoke(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
Object or
void return type in this VM. If the return type of
the method is void, null is returned.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).RMIException - An exception occurred on while invoking the method in
this VMpublic AsyncInvocation invokeAsync(java.lang.Class c, java.lang.String methodName, java.lang.Object[] args)
Object or
void return type in this VM. If the return type of
the method is void, null is returned.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).public AsyncInvocation invokeAsync(java.lang.Object o, java.lang.String methodName, java.lang.Object[] args)
Object or
void return type in this VM. If the return type of
the method is void, null is returned.o - The object on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).public AsyncInvocation invokeAsync(java.lang.Runnable r)
run method of a Runnable in this
VM. Recall that run takes no arguments and has no
return value.r - The Runnable to be runSerializableRunnablepublic AsyncInvocation invokeAsync(java.util.concurrent.Callable c)
call method of a Runnable in this
VM.c - The Callable to be runSerializableCallablepublic void invoke(java.lang.Runnable r)
run method of a Runnable in this
VM. Recall that run takes no arguments and has no
return value.r - The Runnable to be runSerializableRunnablepublic java.lang.Object invoke(java.util.concurrent.Callable c)
run method of a Runnable in this
VM. Recall that run takes no arguments and has no
return value.c - The Callable to be runSerializableCallablepublic void invokeRepeatingIfNecessary(RepeatableRunnable o, long repeatTimeoutMs)
runRunnable in this
VM. If the invocation throws AssertionFailedError, and repeatTimeoutMs
is >0, the run method is invoked repeatedly until it
either succeeds, or repeatTimeoutMs has passed. The AssertionFailedError
is thrown back to the sender of this method if run has not
completed successfully before repeatTimeoutMs has passed.public java.lang.Object invoke(java.lang.Object o,
java.lang.String methodName)
Object or void. If the return type
of the method is void, null is
returned.o - The receiver of the method invocationmethodName - The name of the method to invokeRMIException - An exception occurred on while invoking the method in
this VMpublic java.lang.Object invoke(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
Object or void. If the return type of the method
is void, null is returned.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).RMIException - An exception occurred on while invoking the method in
this VMpublic void invokeMain(java.lang.Class c,
java.lang.String[] args)
main method of a given classc - The class on which to invoke the main methodargs - The "command line" arguments to pass to the
main methodpublic AsyncInvocation invokeMainAsync(java.lang.Class c, java.lang.String[] args)
main method of a given
classc - The class on which to invoke the main methodargs - The "command line" arguments to pass to the
main methodpublic boolean invokeBoolean(java.lang.Class c,
java.lang.String methodName)
boolean return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a booleanRMIException - An exception occurred on while invoking the method in
this VMpublic boolean invokeBoolean(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
boolean return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a booleanRMIException - An exception occurred on while invoking the method in
this VMpublic boolean invokeBoolean(java.lang.Object o,
java.lang.String methodName)
boolean.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a booleanRMIException - An exception occurred on while invoking the method in
this VMpublic boolean invokeBoolean(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
boolean.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a booleanRMIException - An exception occurred on while invoking the method in
this VMpublic char invokeChar(java.lang.Class c,
java.lang.String methodName)
char return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a charRMIException - An exception occurred on while invoking the method in
this VMpublic char invokeChar(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
char return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a charRMIException - An exception occurred on while invoking the method in
this VMpublic char invokeChar(java.lang.Object o,
java.lang.String methodName)
char.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a charRMIException - An exception occurred on while invoking the method in
this VMpublic char invokeChar(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
char.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a charRMIException - An exception occurred on while invoking the method in
this VMpublic byte invokeByte(java.lang.Class c,
java.lang.String methodName)
byte return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a byteRMIException - An exception occurred on while invoking the method in
this VMpublic byte invokeByte(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
byte return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a byteRMIException - An exception occurred on while invoking the method in
this VMpublic byte invokeByte(java.lang.Object o,
java.lang.String methodName)
byte.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a byteRMIException - An exception occurred on while invoking the method in
this VMpublic byte invokeByte(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
byte.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a byteRMIException - An exception occurred on while invoking the method in
this VMpublic short invokeShort(java.lang.Class c,
java.lang.String methodName)
short return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a shortRMIException - An exception occurred on while invoking the method in
this VMpublic short invokeShort(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
short return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a shortRMIException - An exception occurred on while invoking the method in
this VMpublic short invokeShort(java.lang.Object o,
java.lang.String methodName)
short.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a shortRMIException - An exception occurred on while invoking the method in
this VMpublic short invokeShort(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
short.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a shortRMIException - An exception occurred on while invoking the method in
this VMpublic int invokeInt(java.lang.Class c,
java.lang.String methodName)
int return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a intRMIException - An exception occurred on while invoking the method in
this VMpublic int invokeInt(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
int return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a intRMIException - An exception occurred on while invoking the method in
this VMpublic int invokeInt(java.lang.Object o,
java.lang.String methodName)
int.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a intRMIException - An exception occurred on while invoking the method in
this VMpublic int invokeInt(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
int.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a intRMIException - An exception occurred on while invoking the method in
this VMpublic long invokeLong(java.lang.Class c,
java.lang.String methodName)
long return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a longRMIException - An exception occurred on while invoking the method in
this VMpublic long invokeLong(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
long return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a longRMIException - An exception occurred on while invoking the method in
this VMpublic long invokeLong(java.lang.Object o,
java.lang.String methodName)
long.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a longRMIException - An exception occurred on while invoking the method in
this VMpublic long invokeLong(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
long.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a longRMIException - An exception occurred on while invoking the method in
this VMpublic float invokeFloat(java.lang.Class c,
java.lang.String methodName)
float return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a floatRMIException - An exception occurred on while invoking the method in
this VMpublic float invokeFloat(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
float return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a floatRMIException - An exception occurred on while invoking the method in
this VMpublic float invokeFloat(java.lang.Object o,
java.lang.String methodName)
float.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a floatRMIException - An exception occurred on while invoking the method in
this VMpublic float invokeFloat(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
float.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a floatRMIException - An exception occurred on while invoking the method in
this VMpublic double invokeDouble(java.lang.Class c,
java.lang.String methodName)
double return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a doubleRMIException - An exception occurred on while invoking the method in
this VMpublic double invokeDouble(java.lang.Class c,
java.lang.String methodName,
java.lang.Object[] args)
double return type
in this VM.c - The class on which to invoke the methodmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a doubleRMIException - An exception occurred on while invoking the method in
this VMpublic double invokeDouble(java.lang.Object o,
java.lang.String methodName)
double.o - The receiver of the method invocationmethodName - The name of the method to invokejava.lang.IllegalArgumentException - The method does not return a doubleRMIException - An exception occurred on while invoking the method in
this VMpublic double invokeDouble(java.lang.Object o,
java.lang.String methodName,
java.lang.Object[] args)
double.o - The receiver of the method invocationmethodName - The name of the method to invokeargs - Arguments passed to the method call (must be Serializable).java.lang.IllegalArgumentException - The method does not return a doubleRMIException - An exception occurred on while invoking the method in
this VMpublic void bounce()
VM.
Concurrent bounce attempts are synchronized but attempts to invoke
methods on a bouncing VM will cause test failure. Tests using bounce
should be placed at the end of the dunit test suite, since an exception
here will cause all tests using the unsuccessfully bounced VM to fail.
This method is currently not supported by the standalone dunit
runner.RMIException - if an exception occurs while bouncing this VM, for
example a HydraTimeoutException if the VM fails to stop.public java.lang.String toString()
toString in class java.lang.Objectpublic static int getCurrentVMNum()
public java.io.File getWorkingDirectory()