tillrohrmann closed pull request #6844: [FLINK-10546] Remove 
StandaloneMiniCluster
URL: https://github.com/apache/flink/pull/6844
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/StandaloneMiniCluster.java
 
b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/StandaloneMiniCluster.java
deleted file mode 100644
index 1ef1f3b5832..00000000000
--- 
a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/StandaloneMiniCluster.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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.minicluster;
-
-import org.apache.flink.configuration.Configuration;
-import org.apache.flink.configuration.JobManagerOptions;
-import org.apache.flink.runtime.akka.AkkaUtils;
-import org.apache.flink.runtime.clusterframework.types.ResourceID;
-import org.apache.flink.runtime.concurrent.Executors;
-import org.apache.flink.runtime.concurrent.FutureUtils;
-import org.apache.flink.runtime.highavailability.HighAvailabilityServices;
-import org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils;
-import org.apache.flink.runtime.jobmanager.JobManager;
-import org.apache.flink.runtime.jobmanager.MemoryArchivist;
-import org.apache.flink.runtime.messages.TaskManagerMessages;
-import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
-import org.apache.flink.runtime.metrics.MetricRegistryImpl;
-import org.apache.flink.runtime.taskmanager.TaskManager;
-import org.apache.flink.util.AutoCloseableAsync;
-import org.apache.flink.util.ExceptionUtils;
-import org.apache.flink.util.Preconditions;
-
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.pattern.Patterns;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import scala.Option;
-import scala.concurrent.Await;
-import scala.concurrent.Future;
-import scala.concurrent.duration.Duration;
-import scala.concurrent.duration.FiniteDuration;
-
-/**
- * Mini cluster to run the old JobManager code without embedded high 
availability services. This
- * class has been implemented because the normal {@link FlinkMiniCluster} has 
been changed to use
- * the {@link HighAvailabilityServices}. With this change we can no longer use 
the
- * {@link org.apache.flink.api.java.RemoteEnvironment} to connect against the
- * {@link FlinkMiniCluster}, because the remote environment cannot retrieve 
the current leader
- * session id.
- */
-public class StandaloneMiniCluster implements AutoCloseableAsync {
-
-       private static final String LOCAL_HOSTNAME = "localhost";
-
-       private final Configuration configuration;
-
-       private final ActorSystem actorSystem;
-
-       private final ScheduledExecutorService scheduledExecutorService;
-
-       private final HighAvailabilityServices highAvailabilityServices;
-
-       private final MetricRegistryImpl metricRegistry;
-
-       private final FiniteDuration timeout;
-
-       private final int port;
-
-       public StandaloneMiniCluster(Configuration configuration) throws 
Exception {
-               this.configuration = Preconditions.checkNotNull(configuration);
-
-               timeout = AkkaUtils.getTimeout(configuration);
-
-               actorSystem = JobManager.startActorSystem(
-                       configuration,
-                       LOCAL_HOSTNAME,
-                       0);
-
-               port = configuration.getInteger(JobManagerOptions.PORT);
-
-               scheduledExecutorService = new ScheduledThreadPoolExecutor(1);
-
-               highAvailabilityServices = 
HighAvailabilityServicesUtils.createHighAvailabilityServices(
-                       configuration,
-                       Executors.directExecutor(),
-                       
HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION);
-
-               metricRegistry = new MetricRegistryImpl(
-                       
MetricRegistryConfiguration.fromConfiguration(configuration));
-
-               metricRegistry.startQueryService(actorSystem, null);
-
-               JobManager.startJobManagerActors(
-                       configuration,
-                       actorSystem,
-                       scheduledExecutorService,
-                       scheduledExecutorService,
-                       highAvailabilityServices,
-                       metricRegistry,
-                       Option.empty(),
-                       JobManager.class,
-                       MemoryArchivist.class);
-
-               final ResourceID taskManagerResourceId = ResourceID.generate();
-
-               ActorRef taskManager = 
TaskManager.startTaskManagerComponentsAndActor(
-                       configuration,
-                       taskManagerResourceId,
-                       actorSystem,
-                       highAvailabilityServices,
-                       metricRegistry,
-                       LOCAL_HOSTNAME,
-                       Option.<String>empty(),
-                       true,
-                       TaskManager.class);
-
-               Future<Object> registrationFuture = Patterns.ask(
-                       taskManager,
-                       
TaskManagerMessages.getNotifyWhenRegisteredAtJobManagerMessage(),
-                       timeout.toMillis());
-
-               Await.ready(registrationFuture, timeout);
-       }
-
-       public String getHostname() {
-               return LOCAL_HOSTNAME;
-       }
-
-       public int getPort() {
-               return port;
-       }
-
-       public Configuration getConfiguration() {
-               return configuration;
-       }
-
-       @Override
-       public CompletableFuture<Void> closeAsync() {
-               Exception exception = null;
-
-               try {
-                       metricRegistry.shutdown();
-               } catch (Exception e) {
-                       exception = ExceptionUtils.firstOrSuppressed(e, 
exception);
-               }
-
-               actorSystem.terminate();
-               try {
-                       Await.ready(actorSystem.whenTerminated(), 
Duration.Inf());
-               } catch (InterruptedException | TimeoutException e) {
-                       exception = e;
-               }
-
-               try {
-                       highAvailabilityServices.closeAndCleanupAllData();
-               } catch (Exception e) {
-                       exception = e;
-               }
-
-               scheduledExecutorService.shutdownNow();
-
-               try {
-                       
scheduledExecutorService.awaitTermination(timeout.toMillis(), 
TimeUnit.MILLISECONDS);
-               } catch (InterruptedException e) {
-                       Thread.currentThread().interrupt();
-
-                       exception = ExceptionUtils.firstOrSuppressed(e, 
exception);
-               }
-
-               if (exception != null) {
-                       return FutureUtils.completedExceptionally(exception);
-               } else {
-                       return CompletableFuture.completedFuture(null);
-               }
-       }
-}
diff --git 
a/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala 
b/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
index d493495d484..cf60a14b15f 100644
--- 
a/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
+++ 
b/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
@@ -20,16 +20,14 @@ package org.apache.flink.api.scala
 
 import java.io._
 
-import org.apache.commons.cli.{CommandLine, Options}
 import org.apache.flink.client.cli.{CliFrontend, CliFrontendParser}
 import org.apache.flink.client.deployment.ClusterDescriptor
 import org.apache.flink.client.program.ClusterClient
-import org.apache.flink.configuration.{Configuration, CoreOptions, 
GlobalConfiguration, JobManagerOptions}
+import org.apache.flink.configuration.{Configuration, GlobalConfiguration, 
JobManagerOptions}
 import org.apache.flink.runtime.akka.AkkaUtils
-import org.apache.flink.runtime.minicluster.{MiniCluster, 
MiniClusterConfiguration, StandaloneMiniCluster}
+import org.apache.flink.runtime.minicluster.{MiniCluster, 
MiniClusterConfiguration}
 
 import scala.collection.mutable.ArrayBuffer
-import scala.collection.JavaConverters._
 import scala.tools.nsc.Settings
 import scala.tools.nsc.interpreter._
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to