You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 11:04:06 UTC

svn commit: r1132227 - in /incubator/mesos/trunk/src/java: jni/construct.cpp jni/mesos_MesosSchedulerDriver.cpp src/mesos/MesosExecutorDriver.java src/mesos/MesosSchedulerDriver.java

Author: benh
Date: Sun Jun  5 09:04:06 2011
New Revision: 1132227

URL: http://svn.apache.org/viewvc?rev=1132227&view=rev
Log:
Fixing regression from switch to JNI that broke scheduler failover mechanism.

Modified:
    incubator/mesos/trunk/src/java/jni/construct.cpp
    incubator/mesos/trunk/src/java/jni/mesos_MesosSchedulerDriver.cpp
    incubator/mesos/trunk/src/java/src/mesos/MesosExecutorDriver.java
    incubator/mesos/trunk/src/java/src/mesos/MesosSchedulerDriver.java

Modified: incubator/mesos/trunk/src/java/jni/construct.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/jni/construct.cpp?rev=1132227&r1=1132226&r2=1132227&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/jni/construct.cpp (original)
+++ incubator/mesos/trunk/src/java/jni/construct.cpp Sun Jun  5 09:04:06 2011
@@ -19,6 +19,10 @@ using std::string;
 template <typename T>
 T parse(const void* data, int size)
 {
+  // This should always get called with data that can be parsed (i.e.,
+  // ParseFromZeroCopyStream should never return false) because we
+  // have static type checking in Java and C++. A dynamic language
+  // will not have this luxury.
   google::protobuf::io::ArrayInputStream stream(data, size);
   T t;
   t.ParseFromZeroCopyStream(&stream);

Modified: incubator/mesos/trunk/src/java/jni/mesos_MesosSchedulerDriver.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/jni/mesos_MesosSchedulerDriver.cpp?rev=1132227&r1=1132226&r2=1132227&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/jni/mesos_MesosSchedulerDriver.cpp (original)
+++ incubator/mesos/trunk/src/java/jni/mesos_MesosSchedulerDriver.cpp Sun Jun  5 09:04:06 2011
@@ -396,11 +396,17 @@ JNIEXPORT void JNICALL Java_mesos_MesosS
 
   // Get out the url passed into the constructor.
   jfieldID url = env->GetFieldID(clazz, "url", "Ljava/lang/String;");
-  jobject jstr = env->GetObjectField(thiz, url);
+  jobject jurl = env->GetObjectField(thiz, url);
+
+  // Get out the framework id possibly passed into the constructor.
+  jfieldID frameworkId = env->GetFieldID(clazz, "frameworkId", "Lmesos/Protos$FrameworkID;");
+  jobject jframeworkId = env->GetObjectField(thiz, frameworkId);
   
   // Create the C++ driver and initialize the __driver variable.
   MesosSchedulerDriver* driver =
-    new MesosSchedulerDriver(sched, construct<string>(env, jstr));
+    new MesosSchedulerDriver(sched,
+			     construct<string>(env, jurl),
+			     construct<FrameworkID>(env, jframeworkId));
 
   jfieldID __driver = env->GetFieldID(clazz, "__driver", "J");
   env->SetLongField(thiz, __driver, (jlong) driver);

Modified: incubator/mesos/trunk/src/java/src/mesos/MesosExecutorDriver.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/src/mesos/MesosExecutorDriver.java?rev=1132227&r1=1132226&r2=1132227&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/src/mesos/MesosExecutorDriver.java (original)
+++ incubator/mesos/trunk/src/java/src/mesos/MesosExecutorDriver.java Sun Jun  5 09:04:06 2011
@@ -36,7 +36,7 @@ public class MesosExecutorDriver impleme
   protected native void initialize();
   protected native void finalize();
 
-  private Executor exec;
+  private final Executor exec;
   
   private long __exec;
   private long __driver;

Modified: incubator/mesos/trunk/src/java/src/mesos/MesosSchedulerDriver.java
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/java/src/mesos/MesosSchedulerDriver.java?rev=1132227&r1=1132226&r2=1132227&view=diff
==============================================================================
--- incubator/mesos/trunk/src/java/src/mesos/MesosSchedulerDriver.java (original)
+++ incubator/mesos/trunk/src/java/src/mesos/MesosSchedulerDriver.java Sun Jun  5 09:04:06 2011
@@ -50,9 +50,9 @@ public class MesosSchedulerDriver implem
   protected native void initialize();
   protected native void finalize();
 
-  private Scheduler sched;
-  private String url;
-  private FrameworkID frameworkId;
+  private final Scheduler sched;
+  private final String url;
+  private final FrameworkID frameworkId;
 
   private long __sched;
   private long __driver;