Repository: mesos Updated Branches: refs/heads/0.28.x e8ec0398d -> a82539ff2
Removed JNI major version check. The major version check makes upgrading frameworks unnecessarily hard because you would have to deploy Mesos and frameworks in lockstep. Dependency management should be done outside of the code but through package metadata. Review: https://reviews.apache.org/r/48745/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/76ce056b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/76ce056b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/76ce056b Branch: refs/heads/0.28.x Commit: 76ce056b14abddc7f1070d6402ac408756eea355 Parents: e8ec039 Author: Jiang Yan Xu <y...@jxu.me> Authored: Fri Jun 17 08:16:10 2016 -0700 Committer: Jiang Yan Xu <xuj...@apple.com> Committed: Tue Aug 16 09:57:11 2016 -0700 ---------------------------------------------------------------------- src/java/jni/convert.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/76ce056b/src/java/jni/convert.cpp ---------------------------------------------------------------------- diff --git a/src/java/jni/convert.cpp b/src/java/jni/convert.cpp index f1a486d..095943a 100644 --- a/src/java/jni/convert.cpp +++ b/src/java/jni/convert.cpp @@ -140,34 +140,12 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved) mesosClassLoader = env->NewWeakGlobalRef(classLoader); } - // Check that we are loading the correct version of the native library. - jclass clazz = FindMesosClass(env, "org/apache/mesos/MesosNativeLibrary"); - jobject jVERSION = env->GetStaticObjectField( - clazz, env->GetStaticFieldID(clazz, "VERSION", "Ljava/lang/String;")); - - const string& jarVersion = construct<string>(env, jVERSION); - - const string jarMajorVersion = strings::split(jarVersion, ".")[0]; - const string nativeMajorVersion = strings::split(MESOS_VERSION, ".")[0]; - - if (jarMajorVersion != nativeMajorVersion) { - env->DeleteWeakGlobalRef(mesosClassLoader); - mesosClassLoader = NULL; - const string& error = - "Mesos JAR version " + jarVersion + - " is not backwards compatible with Mesos native library version " + - MESOS_VERSION; - clazz = env->FindClass("java/lang/UnsatisfiedLinkError"); - env->ThrowNew(clazz, error.c_str()); - return JNI_ERR; - } - // Set the 'loaded' property so we don't try and load it again. This // is necessary because a native library can be loaded either with // 'System.load' or 'System.loadLibrary' and while redundant calls // to 'System.loadLibrary' will be ignored one call of each could // cause an error. - clazz = FindMesosClass(env, "org/apache/mesos/MesosNativeLibrary"); + jclass clazz = FindMesosClass(env, "org/apache/mesos/MesosNativeLibrary"); jfieldID loaded = env->GetStaticFieldID(clazz, "loaded", "Z"); env->SetStaticBooleanField(clazz, loaded, (jboolean) true);