An encapsulating wrapper around a Java virtual machine.
More...
#include <virtualmachine.hxx>
An encapsulating wrapper around a Java virtual machine.
Definition at line 40 of file virtualmachine.hxx.
◆ VirtualMachine() [1/2]
VirtualMachine::VirtualMachine |
( |
JavaVM * |
pVm, |
|
|
int |
nVersion, |
|
|
bool |
bDestroy, |
|
|
JNIEnv const * |
pMainThreadEnv |
|
) |
| |
Create a wrapper around a Java virtual machine.
- Parameters
-
pVm | A JNI pointer to virtual machine. Must not be null. |
nVersion | The JNI version of the virtual machine pointed to by pVm. Must be at least JNI_VERSION_1_2. This parameter should be of type jint, not int, but at least on some platforms the definition of jint changed from JDK 1.3 (long) to JDK 1.4 (int), so that the mangled C++ name of the constructor would depend on the JDK version used at compile time. |
bDestroy | Whether to destroy the virtual machine when destructing the wrapper (i.e., whether the wrapper owns the virtual machine pointed to by pVm). |
pMainThreadEnv | A valid JNI environment pointer for the current thread; must not be null. The current thread must be "initially attached" to the virtual machine while this constructor is being called (i.e., it must be the thread that has called JNI_CreateJavaVM in case the virtual machine has been started via the JNI Invocation API, and it must not already have called DetachCurrentThread; or it must be executing native code called from a "primordial" virtual machine). This environment pointer was formerly used to obtain a reference to the thread's current context class loader (java.lang.Thread.getCurrentClassLoader; if later a native thread was attached to the virtual machine, that thread's context class loader would be null, so the AttachGuard first of all set it to the saved value; this feature has been removed again for performance reasons and because the default context class loader is often not useful, so that code relying on a context class loader has to set one explicitly, anyway). This parameter is currently unused (but may be used again in the future). |
Definition at line 60 of file virtualmachine.cxx.
References nVersion.
◆ VirtualMachine() [2/2]
◆ ~VirtualMachine()
VirtualMachine::~VirtualMachine |
( |
| ) |
|
|
overrideprivatevirtual |
◆ attachThread()
JNIEnv * VirtualMachine::attachThread |
( |
bool * |
pAttached | ) |
const |
|
private |
◆ detachThread()
void VirtualMachine::detachThread |
( |
| ) |
const |
|
private |
◆ operator=()
◆ AttachGuard
◆ m_bDestroy
bool jvmaccess::VirtualMachine::m_bDestroy |
|
private |
◆ m_nVersion
jint jvmaccess::VirtualMachine::m_nVersion |
|
private |
◆ m_pVm
JavaVM* jvmaccess::VirtualMachine::m_pVm |
|
private |
The documentation for this class was generated from the following files: