libcommonc++
0.7
|
An object that encapsulates (most of) the Java Native Interface (JNI) to a Java Virtual Machine. More...
#include <JavaVirtualMachine.h++>
Public Member Functions | |
JavaVirtualMachine (const SearchPath &classPath=SearchPath::empty, const SearchPath &linkerPath=SearchPath::empty, uint_t initialHeapSize=0, uint_t maxHeapSize=0, bool server=false, bool verbose=false, bool nojit=false) | |
Construct and initialize a new Java Virtual Machine. More... | |
JavaVirtualMachine (JavaVM *jvm) | |
Construct a JavaVirtualMachine object for the given JavaVM instance. More... | |
~JavaVirtualMachine () | |
Destructor. More... | |
JavaContext | attachThread () |
Attach the calling native thread to the Java Virtual Machine if it is not already attached, and return the JavaContext for the calling thread. More... | |
void | detachThread () |
Detach the calling native thread from the Java Virtual Machine. More... | |
bool | isVerbose () const |
Determine if verbose mode is enabled for this JVM. More... | |
An object that encapsulates (most of) the Java Native Interface (JNI) to a Java Virtual Machine.
Since the JNI Environment pointers are stored in thread-local storage, instances of this class may be used concurrently from multiple native threads, provided that each native thread attaches to the JVM via attachThread() before performing any JNI operations and detaches via detachThread() afterwards.
For more information about the JNI, see The Java Native Interface Programmer's Guide and Specification.
JavaVirtualMachine | ( | const SearchPath & | classPath = SearchPath::empty , |
const SearchPath & | linkerPath = SearchPath::empty , |
||
uint_t | initialHeapSize = 0 , |
||
uint_t | maxHeapSize = 0 , |
||
bool | server = false , |
||
bool | verbose = false , |
||
bool | nojit = false |
||
) |
Construct and initialize a new Java Virtual Machine.
classPath | The path for locating classes and JAR files. |
linkerPath | The path for locating native libraries. |
initialHeapSize | The initial JVM heap size, in megabytes. |
maxHeapSize | The maximum JVM heap size, in megabytes. |
server | A flag indicating whether the Server VM (true) or Client VM (false) should be used. |
verbose | A flag indicating whether verbose mode should be enabled. |
nojit | A flag indicating whether the Just-in-Time (JIT) compiler should be disabled. |
JavaVirtualMachine | ( | JavaVM * | jvm | ) |
Construct a JavaVirtualMachine object for the given JavaVM instance.
jvm | The JavaVM instance. |
~JavaVirtualMachine | ( | ) |
Destructor.
Shuts down and destroys the Java Virtual Machine.
JavaContext attachThread | ( | ) |
Attach the calling native thread to the Java Virtual Machine if it is not already attached, and return the JavaContext for the calling thread.
JavaException | If an error occurs. |
void detachThread | ( | ) |
Detach the calling native thread from the Java Virtual Machine.
If the thread is already detached, the method has no effect.
JavaException | If an error occurs. |
|
inline |
Determine if verbose mode is enabled for this JVM.