Kaydet (Commit) 0251d536 authored tarafından Jens-Heiner Rechtien's avatar Jens-Heiner Rechtien

INTEGRATION: CWS nojava1 (1.3.42); FILE MERGED

2004/08/16 15:20:48 cmc 1.3.42.2: #i33045# use normal -DSOLAR_JAVA
2004/08/16 14:21:41 cmc 1.3.42.1: #i33045# build jvmaccess even without java, just default to failure on javarelated stuff
üst 4ff64a32
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: virtualmachine.cxx,v $ * $RCSfile: virtualmachine.cxx,v $
* *
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* last change: $Author: obo $ $Date: 2003-09-04 11:40:56 $ * last change: $Author: hr $ $Date: 2004-11-09 11:50:10 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -125,6 +125,7 @@ VirtualMachine::~VirtualMachine() ...@@ -125,6 +125,7 @@ VirtualMachine::~VirtualMachine()
void VirtualMachine::acquireInitialContextClassLoader(JNIEnv * pEnv) void VirtualMachine::acquireInitialContextClassLoader(JNIEnv * pEnv)
{ {
#ifdef SOLAR_JAVA
jclass aClass = pEnv->FindClass("java/lang/Thread"); jclass aClass = pEnv->FindClass("java/lang/Thread");
jmethodID aMethod1 = pEnv->GetStaticMethodID(aClass, "currentThread", jmethodID aMethod1 = pEnv->GetStaticMethodID(aClass, "currentThread",
"()Ljava/lang/Thread;"); "()Ljava/lang/Thread;");
...@@ -142,10 +143,12 @@ void VirtualMachine::acquireInitialContextClassLoader(JNIEnv * pEnv) ...@@ -142,10 +143,12 @@ void VirtualMachine::acquireInitialContextClassLoader(JNIEnv * pEnv)
OSL_ENSURE(m_aInitialContextClassLoader != 0, OSL_ENSURE(m_aInitialContextClassLoader != 0,
"JNI: NewGlobalRef failed"); "JNI: NewGlobalRef failed");
} }
#endif
} }
void VirtualMachine::releaseInitialContextClassLoader() const void VirtualMachine::releaseInitialContextClassLoader() const
{ {
#ifdef SOLAR_JAVA
if (m_aInitialContextClassLoader != 0) if (m_aInitialContextClassLoader != 0)
{ {
JNIEnv * pEnv; JNIEnv * pEnv;
...@@ -159,10 +162,14 @@ void VirtualMachine::releaseInitialContextClassLoader() const ...@@ -159,10 +162,14 @@ void VirtualMachine::releaseInitialContextClassLoader() const
OSL_ENSURE(n == JNI_OK, "JNI: DetachCurrentThread failed"); OSL_ENSURE(n == JNI_OK, "JNI: DetachCurrentThread failed");
} }
} }
#endif
} }
JNIEnv * VirtualMachine::attachThread(bool * pAttached) const JNIEnv * VirtualMachine::attachThread(bool * pAttached) const
{ {
#ifndef SOLAR_JAVA
return 0;
#else
OSL_ENSURE(pAttached != 0, "bad parameter"); OSL_ENSURE(pAttached != 0, "bad parameter");
JNIEnv * pEnv; JNIEnv * pEnv;
jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion); jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion);
...@@ -190,10 +197,13 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const ...@@ -190,10 +197,13 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const
else else
*pAttached = false; *pAttached = false;
return pEnv; return pEnv;
#endif
} }
void VirtualMachine::detachThread() const void VirtualMachine::detachThread() const
{ {
#ifdef SOLAR_JAVA
jint n = m_pVm->DetachCurrentThread(); jint n = m_pVm->DetachCurrentThread();
OSL_ENSURE(n == JNI_OK, "JNI: DetachCurrentThread failed"); OSL_ENSURE(n == JNI_OK, "JNI: DetachCurrentThread failed");
#endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment