Search in sources :

Example 1 with BootstrapSetup

use of akka.actor.BootstrapSetup in project flink by apache.

the class RobustActorSystem method create.

private static RobustActorSystem create(String name, ActorSystemSetup setup, Option<Thread.UncaughtExceptionHandler> uncaughtExceptionHandler) {
    final Optional<BootstrapSetup> bootstrapSettings = setup.get(BootstrapSetup.class);
    final ClassLoader classLoader = RobustActorSystem.class.getClassLoader();
    final Config appConfig = bootstrapSettings.map(BootstrapSetup::config).flatMap(RobustActorSystem::toJavaOptional).orElseGet(() -> ConfigFactory.load(classLoader));
    final Option<ExecutionContext> defaultEC = toScalaOption(bootstrapSettings.map(BootstrapSetup::defaultExecutionContext).flatMap(RobustActorSystem::toJavaOptional));
    final RobustActorSystem robustActorSystem = new RobustActorSystem(name, appConfig, classLoader, defaultEC, setup) {

        @Override
        public Thread.UncaughtExceptionHandler uncaughtExceptionHandler() {
            return uncaughtExceptionHandler.getOrElse(super::uncaughtExceptionHandler);
        }
    };
    robustActorSystem.start();
    return robustActorSystem;
}
Also used : ExecutionContext(scala.concurrent.ExecutionContext) Config(com.typesafe.config.Config) BootstrapSetup(akka.actor.BootstrapSetup)

Aggregations

BootstrapSetup (akka.actor.BootstrapSetup)1 Config (com.typesafe.config.Config)1 ExecutionContext (scala.concurrent.ExecutionContext)1