XComp commented on a change in pull request #16741: URL: https://github.com/apache/flink/pull/16741#discussion_r685933621
########## File path: flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java ########## @@ -0,0 +1,599 @@ +/* + * 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.rpc.akka; + +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.configuration.AkkaOptions; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.configuration.SecurityOptions; +import org.apache.flink.runtime.concurrent.akka.AkkaFutureUtils; +import org.apache.flink.runtime.rpc.RpcSystem; +import org.apache.flink.util.NetUtils; +import org.apache.flink.util.TimeUtils; +import org.apache.flink.util.function.FunctionUtils; + +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import akka.actor.Address; +import akka.actor.AddressFromURIString; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigFactory; +import org.jboss.netty.logging.InternalLoggerFactory; +import org.jboss.netty.logging.Slf4JLoggerFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.InetSocketAddress; +import java.net.MalformedURLException; +import java.time.Duration; +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +/** + * This class contains utility functions for akka. It contains methods to start an actor system with + * a given akka configuration. Furthermore, the akka configuration used for starting the different + * actor systems resides in this class. + */ +class AkkaUtils { + private static final Logger LOG = LoggerFactory.getLogger(AkkaUtils.class); + + private static final String FLINK_ACTOR_SYSTEM_NAME = "flink"; + + public static String getFlinkActorSystemName() { + return FLINK_ACTOR_SYSTEM_NAME; + } + + /** + * Gets the basic Akka config which is shared by remote and local actor systems. + * + * @param configuration instance which contains the user specified values for the configuration + * @return Flink's basic Akka config + */ + private static Config getBasicAkkaConfig(Configuration configuration) { + final int akkaThroughput = configuration.getInteger(AkkaOptions.DISPATCHER_THROUGHPUT); + final String jvmExitOnFatalError = + booleanToString(configuration.getBoolean(AkkaOptions.JVM_EXIT_ON_FATAL_ERROR)); + final String logLifecycleEvents = + booleanToString(configuration.getBoolean(AkkaOptions.LOG_LIFECYCLE_EVENTS)); + final String supervisorStrategy = EscalatingSupervisorStrategy.class.getCanonicalName(); + + return new AkkaConfigBuilder() + .add("akka {") + .add(" daemonic = off") + .add(" loggers = [\"akka.event.slf4j.Slf4jLogger\"]") + .add(" logging-filter = \"akka.event.slf4j.Slf4jLoggingFilter\"") + .add(" log-config-on-start = off") + .add(" logger-startup-timeout = 30s") + .add(" loglevel = " + getLogLevel()) + .add(" stdout-loglevel = OFF") + .add(" log-dead-letters = " + logLifecycleEvents) + .add(" log-dead-letters-during-shutdown = " + logLifecycleEvents) + .add(" jvm-exit-on-fatal-error = " + jvmExitOnFatalError) + .add(" serialize-messages = off") + .add(" actor {") + .add(" guardian-supervisor-strategy = " + supervisorStrategy) + .add(" warn-about-java-serializer-usage = off") + .add(" allow-java-serialization = on") Review comment: you're right - I fetched master but didn't merge it - that's why my diff version was outdated. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
