This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 2f3899e30544102e94e5fdbb91e7cf99066f2552
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Sat Jun 15 13:26:09 2019 -0400

    Added updateFramework() method to java V0 scheduler driver bindings.
    
    Review: https://reviews.apache.org/r/70813/
---
 .../jni/org_apache_mesos_MesosSchedulerDriver.cpp  | 22 +++++++++++++++++++
 .../src/org/apache/mesos/MesosSchedulerDriver.java |  2 ++
 src/java/src/org/apache/mesos/SchedulerDriver.java | 25 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp 
b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
index e042140..b479763 100644
--- a/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
+++ b/src/java/jni/org_apache_mesos_MesosSchedulerDriver.cpp
@@ -1136,4 +1136,26 @@ 
Java_org_apache_mesos_MesosSchedulerDriver_reconcileTasks(
   return convert<Status>(env, status);
 }
 
+/* Class:     org_apache_mesos_MesosSchedulerDriver
+ * Method:    updateFramework
+ * Signature: 
(Lorg/apache/mesos/Protos/FrameworkInfo;)Lorg/apache/mesos/Protos/Status;
+ */
+JNIEXPORT jobject JNICALL
+Java_org_apache_mesos_MesosSchedulerDriver_updateFramework(
+    JNIEnv* env, jobject thiz, jobject jframeworkInfo)
+{
+  const FrameworkInfo& frameworkInfo =
+    construct<FrameworkInfo>(env, jframeworkInfo);
+
+  jclass clazz = env->GetObjectClass(thiz);
+
+  jfieldID __driver = env->GetFieldID(clazz, "__driver", "J");
+  MesosSchedulerDriver* driver =
+    (MesosSchedulerDriver*) env->GetLongField(thiz, __driver);
+
+  Status status = driver->updateFramework(frameworkInfo);
+
+  return convert<Status>(env, status);
+}
+
 } // extern "C" {
diff --git a/src/java/src/org/apache/mesos/MesosSchedulerDriver.java 
b/src/java/src/org/apache/mesos/MesosSchedulerDriver.java
index 07bdd4b..55ebc87 100644
--- a/src/java/src/org/apache/mesos/MesosSchedulerDriver.java
+++ b/src/java/src/org/apache/mesos/MesosSchedulerDriver.java
@@ -298,6 +298,8 @@ public class MesosSchedulerDriver implements 
SchedulerDriver {
 
   public native Status reconcileTasks(Collection<TaskStatus> statuses);
 
+  public native Status updateFramework(FrameworkInfo frameworkInfo);
+
   protected native void initialize();
   protected native void finalize();
 
diff --git a/src/java/src/org/apache/mesos/SchedulerDriver.java 
b/src/java/src/org/apache/mesos/SchedulerDriver.java
index 85faa8e..ee5a9e2 100644
--- a/src/java/src/org/apache/mesos/SchedulerDriver.java
+++ b/src/java/src/org/apache/mesos/SchedulerDriver.java
@@ -323,4 +323,29 @@ public interface SchedulerDriver {
    * @see SlaveID
    */
   Status reconcileTasks(Collection<TaskStatus> statuses);
+
+  /**
+   * Inform Mesos master about changes to the `FrameworkInfo`. The
+   * driver will store the new `FrameworkInfo` and all subsequent
+   * re-registrations will use it.
+   *
+   * NOTE: If the supplied info is invalid or fails authorization,
+   * the `error()` callback will be invoked asynchronously (after
+   * the master replies with a `FrameworkErrorMessage`).
+   *
+   * NOTE: This must be called after initial registration with the
+   * master completes and the `FrameworkID` is assigned. The assigned
+   * `FrameworkID` must be set in `frameworkInfo`.
+   *
+   * NOTE: The `FrameworkInfo.user` and `FrameworkInfo.hostname`
+   * fields will be auto-populated using the same approach used
+   * during driver initialization.
+   *
+   * @param frameworkInfo  The new FrameworkInfo.
+   *
+   * @return               The state of the driver after the call.
+   *
+   * @see FrameworkInfo
+   */
+  Status updateFramework(FrameworkInfo frameworkInfo);
 }

Reply via email to