|
@@ -113,6 +113,9 @@ public:
|
|
|
optionStrings.appendList(conf->queryProp("jvmoptions"), ENVSEPSTR);
|
|
|
}
|
|
|
|
|
|
+ // Options we know we always want set
|
|
|
+ optionStrings.append("-Xrs");
|
|
|
+
|
|
|
// These may be useful for debugging
|
|
|
// optionStrings.append("-Xcheck:jni");
|
|
|
// optionStrings.append("-verbose:jni");
|
|
@@ -243,7 +246,7 @@ public:
|
|
|
rtlFail(0, message.str());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
void ensureContextClassLoaderAvailable ()
|
|
|
{
|
|
|
// JVMs that are created by native threads have a context class loader set to the
|
|
@@ -255,7 +258,7 @@ public:
|
|
|
//
|
|
|
// if (Thread.currentThread().getContextClassLoader == NULL)
|
|
|
// Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
|
|
|
-
|
|
|
+
|
|
|
if (!contextClassLoaderChecked)
|
|
|
{
|
|
|
JNIenv->ExceptionClear();
|
|
@@ -270,7 +273,7 @@ public:
|
|
|
checkException();
|
|
|
jobject contextClassLoaderObj = JNIenv->CallObjectMethod(threadObj, getContextClassLoaderMethod);
|
|
|
checkException();
|
|
|
-
|
|
|
+
|
|
|
if (!contextClassLoaderObj)
|
|
|
{
|
|
|
// No context class loader, so use the system class loader (hopefully it's present)
|
|
@@ -280,7 +283,7 @@ public:
|
|
|
checkException();
|
|
|
jobject systemClassLoaderObj = JNIenv->CallStaticObjectMethod(javaLangClassLoaderClass, getSystemClassLoaderMethod);
|
|
|
checkException();
|
|
|
-
|
|
|
+
|
|
|
if (systemClassLoaderObj)
|
|
|
{
|
|
|
jmethodID setContextClassLoaderMethod = JNIenv->GetMethodID(javaLangThreadClass, "setContextClassLoader", "(Ljava/lang/ClassLoader;)V");
|
|
@@ -289,7 +292,7 @@ public:
|
|
|
checkException();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
contextClassLoaderChecked = true;
|
|
|
}
|
|
|
}
|
|
@@ -301,11 +304,11 @@ public:
|
|
|
if (!prevtext || strcmp(text, prevtext) != 0)
|
|
|
{
|
|
|
prevtext.clear();
|
|
|
-
|
|
|
+
|
|
|
// Make sure there is a context class loader available; we need to
|
|
|
// do this before calling FindClass() on the class we need
|
|
|
ensureContextClassLoaderAvailable();
|
|
|
-
|
|
|
+
|
|
|
// Name should be in the form class.method:signature
|
|
|
const char *funcname = strchr(text, '.');
|
|
|
if (!funcname)
|