tillrohrmann commented on a change in pull request #13004:
URL: https://github.com/apache/flink/pull/13004#discussion_r468582179



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/active/ResourceManagerDriver.java
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.resourcemanager.active;
+
+import org.apache.flink.runtime.clusterframework.ApplicationStatus;
+import org.apache.flink.runtime.clusterframework.TaskExecutorProcessSpec;
+import org.apache.flink.runtime.clusterframework.types.ResourceIDRetrievable;
+import 
org.apache.flink.runtime.resourcemanager.exceptions.ResourceManagerException;
+
+import javax.annotation.Nullable;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * A {@link ResourceManagerDriver} is responsible for requesting and releasing 
resources from/to a particular external
+ * resource manager.
+ */
+public interface ResourceManagerDriver<WorkerType extends 
ResourceIDRetrievable> {
+
+       /**
+        * Initialize the deployment specific components.
+        *
+        * @param resourceEventHandler Handler that handles resource events.
+        */
+       void initialize(ResourceEventHandler<WorkerType> resourceEventHandler) 
throws Throwable;
+
+       /**
+        * Terminate the deployment specific components.
+        *
+        * @return A future that will be completed successfully when the driver 
is terminated, or exceptionally if cannot be
+        * terminated.
+        */
+       CompletableFuture<Void> terminate();
+
+       /**
+        * The deployment specific code to deregister the application. This 
should report the application's final status and
+        * shut down the resource manager driver cleanly.
+        *
+        * <p>This method also needs to make sure all pending containers that 
are not registered yet are returned.
+        *
+        * @param finalStatus The application status to report.
+        * @param optionalDiagnostics A diagnostics message or {@code null}.
+        * @throws ResourceManagerException if the application could not be 
shut down.
+        */
+       void deregisterApplication(ApplicationStatus finalStatus, @Nullable 
String optionalDiagnostics) throws Throwable;

Review comment:
       Maybe a `CompletableFutuer<Void> terminate(ApplicationStatus 
finalStatus, String diagnostics)` could be enough instead of having two 
methods. Or maybe `deregisterApplication` only deregisters the application but 
does not shut down the component.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to