30VirtualMachine::AttachGuard::CreationException::CreationException()
33VirtualMachine::AttachGuard::CreationException::CreationException(
38VirtualMachine::AttachGuard::CreationException::operator =(
44VirtualMachine::AttachGuard::AttachGuard(
46 m_xMachine(
std::move(xMachine))
57 m_xMachine->detachThread();
61 JNIEnv
const * pMainThreadEnv):
64 (void) pMainThreadEnv;
65 assert(pVm !=
nullptr);
67 assert(pMainThreadEnv);
87 assert(pAttached !=
nullptr &&
"bad parameter");
91 n != JNI_OK &&
n != JNI_EDETACHED,
"jvmaccess",
"JNI: GetEnv failed");
94 if (
m_pVm->AttachCurrentThread
97 reinterpret_cast< void **
>(&pEnv),
115 jint
n =
m_pVm->DetachCurrentThread();
116 SAL_WARN_IF(
n != JNI_OK,
"jvmaccess",
"JNI: DetachCurrentThread failed");
An exception indicating failure to create an AttachGuard.
~AttachGuard()
Detach the current thread from the virtual machine again.
rtl::Reference< VirtualMachine > m_xMachine
An encapsulating wrapper around a Java virtual machine.
VirtualMachine(JavaVM *pVm, int nVersion, bool bDestroy, JNIEnv const *pMainThreadEnv)
Create a wrapper around a Java virtual machine.
void detachThread() const
JNIEnv * attachThread(bool *pAttached) const
virtual ~VirtualMachine() override
#define SAL_WARN_IF(condition, area, stream)