LibreOffice Module jvmaccess (master) 1
|
A helper to attach a thread to a Java virtual machine. More...
#include <virtualmachine.hxx>
Classes | |
class | CreationException |
An exception indicating failure to create an AttachGuard. More... | |
Public Member Functions | |
AttachGuard (rtl::Reference< VirtualMachine > xMachine) | |
Attach the current thread to a virtual machine. More... | |
~AttachGuard () | |
Detach the current thread from the virtual machine again. More... | |
JNIEnv * | getEnvironment () const |
Get a JNI environment pointer for the current thread. More... | |
Private Member Functions | |
AttachGuard (AttachGuard const &)=delete | |
AttachGuard & | operator= (AttachGuard const &)=delete |
Private Attributes | |
rtl::Reference< VirtualMachine > | m_xMachine |
JNIEnv * | m_pEnvironment |
bool | m_bDetach |
A helper to attach a thread to a Java virtual machine.
@descr Upon construction of a guard the current thread is attached to the virtual machine, and upon destruction of the guard the thread is detached again. For any one thread, multiple instances of this class may be used in a stack-like fashion (care is taken to only really detach the thread from the virtual machine upon destruction of the guard at the bottom of the stack).
Definition at line 53 of file virtualmachine.hxx.
|
explicit |
Attach the current thread to a virtual machine.
rMachine | The virtual machine to attach to. Must not be a null reference. |
CreationException | Thrown in case attaching fails (due to a JNI problem). |
Definition at line 44 of file virtualmachine.cxx.
References m_bDetach, m_pEnvironment, and m_xMachine.
VirtualMachine::AttachGuard::~AttachGuard | ( | ) |
Detach the current thread from the virtual machine again.
Definition at line 54 of file virtualmachine.cxx.
|
privatedelete |
|
inline |
Get a JNI environment pointer for the current thread.
Definition at line 87 of file virtualmachine.hxx.
|
privatedelete |
|
private |
Definition at line 95 of file virtualmachine.hxx.
Referenced by AttachGuard().
|
private |
Definition at line 94 of file virtualmachine.hxx.
Referenced by AttachGuard().
|
private |
Definition at line 93 of file virtualmachine.hxx.
Referenced by AttachGuard().