Repository: activemq-artemis Updated Branches: refs/heads/master dc6fe94bd -> 18e41963b
https://issues.apache.org/jira/browse/ARTEMIS-237 Fixing IBM JDK failures Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/18e41963 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/18e41963 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/18e41963 Branch: refs/heads/master Commit: 18e41963b61a5ef6dbcdb150e27c07c062deaa66 Parents: dc6fe94 Author: Clebert Suconic <clebertsuco...@apache.org> Authored: Tue Sep 29 17:37:04 2015 -0400 Committer: Clebert Suconic <clebertsuco...@apache.org> Committed: Tue Sep 29 21:29:02 2015 -0400 ---------------------------------------------------------------------- artemis-native/bin/libartemis-native-32.so | Bin 22260 -> 22260 bytes artemis-native/bin/libartemis-native-64.so | Bin 21442 -> 23983 bytes ...che_activemq_artemis_jlibaio_LibaioContext.c | 25 +++++++------------ .../activemq/artemis/jlibaio/LibaioContext.java | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/18e41963/artemis-native/bin/libartemis-native-32.so ---------------------------------------------------------------------- diff --git a/artemis-native/bin/libartemis-native-32.so b/artemis-native/bin/libartemis-native-32.so index df4b560..15c3d66 100755 Binary files a/artemis-native/bin/libartemis-native-32.so and b/artemis-native/bin/libartemis-native-32.so differ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/18e41963/artemis-native/bin/libartemis-native-64.so ---------------------------------------------------------------------- diff --git a/artemis-native/bin/libartemis-native-64.so b/artemis-native/bin/libartemis-native-64.so index 1e24db3..e32603b 100755 Binary files a/artemis-native/bin/libartemis-native-64.so and b/artemis-native/bin/libartemis-native-64.so differ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/18e41963/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c ---------------------------------------------------------------------- diff --git a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c index 4776966..3beb1bf 100644 --- a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c +++ b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c @@ -112,6 +112,15 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) { if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_6) != JNI_OK) { return JNI_ERR; } else { + // + // Accordingly to previous experiences we must hold Global Refs on Classes + // And + // + // Accordingly to IBM recommendations here: + // We don't need to hold a global reference on methods: + // http://www.ibm.com/developerworks/java/library/j-jni/index.html#notc + // Which actually caused core dumps + jclass localRuntimeExceptionClass = (*env)->FindClass(env, "java/lang/RuntimeException"); if (localRuntimeExceptionClass == NULL) { // pending exception... @@ -147,13 +156,11 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) { if (errorMethod == NULL) { return JNI_ERR; } - errorMethod = (jmethodID)(*env)->NewGlobalRef(env, (jobject)(errorMethod)); doneMethod = (*env)->GetMethodID(env, submitClass, "done", "()V"); if (doneMethod == NULL) { return JNI_ERR; } - doneMethod = (jmethodID)(*env)->NewGlobalRef(env, (jobject)(doneMethod)); libaioContextClass = (*env)->FindClass(env, "org/apache/activemq/artemis/jlibaio/LibaioContext"); if (libaioContextClass == NULL) { @@ -165,7 +172,6 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) { if (libaioContextDone == NULL) { return JNI_ERR; } - libaioContextDone = (jmethodID)(*env)->NewGlobalRef(env, (jobject)libaioContextDone); return JNI_VERSION_1_6; } @@ -185,15 +191,6 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) { (*env)->DeleteGlobalRef(env, ioExceptionClass); } - // Deleting global refs so their classes can be GCed - if (errorMethod != NULL) { - (*env)->DeleteGlobalRef(env, (jobject)errorMethod); - } - - if (doneMethod != NULL) { - (*env)->DeleteGlobalRef(env, (jobject)doneMethod); - } - if (submitClass != NULL) { (*env)->DeleteGlobalRef(env, (jobject)submitClass); } @@ -201,10 +198,6 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) { if (libaioContextClass != NULL) { (*env)->DeleteGlobalRef(env, (jobject)libaioContextClass); } - - if (libaioContextDone != NULL) { - (*env)->DeleteGlobalRef(env, (jobject)libaioContextDone); - } } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/18e41963/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java ---------------------------------------------------------------------- diff --git a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java index 5ada655..62bd98f 100644 --- a/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java +++ b/artemis-native/src/main/java/org/apache/activemq/artemis/jlibaio/LibaioContext.java @@ -49,7 +49,7 @@ public class LibaioContext<Callback extends SubmitInfo> implements Closeable { * <br> * Or else the native module won't be loaded because of version mismatches */ - private static final int EXPECTED_NATIVE_VERSION = 1; + private static final int EXPECTED_NATIVE_VERSION = 2; private static boolean loaded = false;