Package akka.actor

Class ActorSystemImpl

    • Constructor Detail

      • ActorSystemImpl

        public ActorSystemImpl​(java.lang.String name,
                               com.typesafe.config.Config applicationConfig,
                               java.lang.ClassLoader classLoader,
                               scala.Option<scala.concurrent.ExecutionContext> defaultExecutionContext,
                               scala.Option<Props> guardianProps,
                               ActorSystemSetup setup)
    • Method Detail

      • abort

        public void abort()
        This kind of shutdown attempts to bring the system down and release its resources more forcefully than plain shutdown. For example it will not run CoordinatedShutdown and not wait for remote-deployed child actors to terminate before terminating their parents.
      • aborting

        public boolean aborting()
      • aborting_$eq

        public void aborting_$eq​(boolean x$1)
      • actorOf

        public ActorRef actorOf​(Props props,
                                java.lang.String name)
        Description copied from interface: ActorRefFactory
        Create new actor as child of this context with the given name, which must not be null, empty or start with &ldquo;$&rdquo;. If the given name is already in use, an InvalidActorNameException is thrown.

        See Props for details on how to obtain a Props object.

      • actorOf

        public ActorRef actorOf​(Props props)
        Description copied from interface: ActorRefFactory
        Create new actor as child of this context and give it an automatically generated name (currently similar to base64-encoded integer count, reversed and with &ldquo;$&rdquo; prepended, may change in the future).

        See Props for details on how to obtain a Props object.

      • assertInitialized

        public void assertInitialized()
        Asserts that the ActorSystem has been fully initialized. Can be used to guard code blocks that might accidentally be run during initialization but require a fully initialized ActorSystem before proceeding.
      • classicSystem

        public ActorSystem classicSystem()
        Description copied from interface: ClassicActorSystemProvider
        Allows access to the classic akka.actor.ActorSystem even for akka.actor.typed.ActorSystem[_]s.
      • createDynamicAccess

        protected DynamicAccess createDynamicAccess()
        This is an extension point: by overriding this method, subclasses can control all reflection activities of an actor system.
      • createScheduler

        protected Scheduler createScheduler()
        Create the scheduler service. This one needs one special behavior: if Closeable, it MUST execute all outstanding tasks upon .close() in order to properly shutdown all dispatchers.

        Furthermore, this timer service MUST throw IllegalStateException if it cannot schedule a task. Once scheduled, the task MUST be executed. If executed upon close(), the task may execute before its timeout.

      • deadLetters

        public ActorRef deadLetters()
        Description copied from class: ActorSystem
        Actor reference where messages are re-routed to which were addressed to stopped or non-existing actors. Delivery to this actor is done on a best effort basis and hence not strictly guaranteed.
        Specified by:
        deadLetters in class ActorSystem
      • dispatcher

        public scala.concurrent.ExecutionContextExecutor dispatcher()
        Description copied from class: ActorSystem
        Default dispatcher as configured. This dispatcher is used for all actors in the actor system which do not have a different dispatcher configured explicitly. Importing this member will place the default MessageDispatcher in scope.
        Specified by:
        dispatcher in interface ActorRefFactory
        Specified by:
        dispatcher in class ActorSystem
      • dynamicAccess

        public DynamicAccess dynamicAccess()
        Description copied from class: ExtendedActorSystem
        ClassLoader wrapper which is used for reflective accesses internally. This is set to use the context class loader, if one is set, or the class loader which loaded the ActorSystem implementation. The context class loader is also set on all threads created by the ActorSystem, if one was set during creation.
        Specified by:
        dynamicAccess in class ExtendedActorSystem
      • extension

        public <T extends Extension> T extension​(ExtensionId<T> ext)
        Description copied from class: ActorSystem
        Returns the payload that is associated with the provided extension throws an IllegalStateException if it is not registered. This method can potentially block, waiting for the initialization of the payload, if is in the process of registration from another Thread of execution
        Specified by:
        extension in class ActorSystem
      • getWhenTerminated

        public java.util.concurrent.CompletionStage<Terminated> getWhenTerminated()
        Description copied from class: ActorSystem
        Returns a CompletionStage which will be completed after the ActorSystem has been terminated and termination hooks have been executed. If you registered any callback with ActorSystem.registerOnTermination(scala.Function0<T>), the returned CompletionStage from this method will not complete until all the registered callbacks are finished. Be careful to not schedule any operations, such as thenRunAsync, on the dispatchers (Executor) of this actor system as they will have been shut down before this CompletionStage completes.
        Specified by:
        getWhenTerminated in class ActorSystem
      • guardianProps

        public scala.Option<Props> guardianProps()
      • hasExtension

        public boolean hasExtension​(ExtensionId<? extends Extension> ext)
        Description copied from class: ActorSystem
        Returns whether the specified extension is already registered, this method can potentially block, waiting for the initialization of the payload, if is in the process of registration from another Thread of execution
        Specified by:
        hasExtension in class ActorSystem
      • name

        public java.lang.String name()
        Description copied from class: ActorSystem
        The name of this actor system, used to distinguish multiple ones within the same JVM & class loader.
        Specified by:
        name in class ActorSystem
      • printTree

        public java.lang.String printTree()
        Description copied from class: ExtendedActorSystem
        For debugging: traverse actor hierarchy and make string representation. Careful, this may OOM on large actor systems, and it is only meant for helping debugging in case something already went terminally wrong.
        Specified by:
        printTree in class ExtendedActorSystem
      • registerExtension

        public final <T extends Extension> T registerExtension​(ExtensionId<T> ext)
        Description copied from class: ActorSystem
        Registers the provided extension and creates its payload, if this extension isn't already registered This method has putIfAbsent-semantics, this method can potentially block, waiting for the initialization of the payload, if is in the process of registration from another Thread of execution
        Specified by:
        registerExtension in class ActorSystem
      • registerOnTermination

        public <T> void registerOnTermination​(scala.Function0<T> code)
        Description copied from class: ActorSystem
        Register a block of code (callback) to run after ActorSystem.terminate has been issued and all actors in this actor system have been stopped. Multiple code blocks may be registered by calling this method multiple times. The callbacks will be run sequentially in reverse order of registration, i.e. last registration is run first. Note that ActorSystem will not terminate until all the registered callbacks are finished.

        Throws a RejectedExecutionException if the System has already been terminated or if termination has been initiated.

        Scala API

        Specified by:
        registerOnTermination in class ActorSystem
      • registerOnTermination

        public void registerOnTermination​(java.lang.Runnable code)
        Description copied from class: ActorSystem
        Java API: Register a block of code (callback) to run after ActorSystem.terminate has been issued and all actors in this actor system have been stopped. Multiple code blocks may be registered by calling this method multiple times. The callbacks will be run sequentially in reverse order of registration, i.e. last registration is run first. Note that ActorSystem will not terminate until all the registered callbacks are finished.

        Throws a RejectedExecutionException if the System has already been terminated or if termination has been initiated.

        Specified by:
        registerOnTermination in class ActorSystem
      • scheduler

        public Scheduler scheduler()
        Description copied from class: ActorSystem
        Light-weight scheduler for running asynchronous tasks after some deadline in the future. Not terribly precise but cheap.
        Specified by:
        scheduler in class ActorSystem
      • stop

        public void stop​(ActorRef actor)
        Description copied from interface: ActorRefFactory
        Stop the actor pointed to by the given ActorRef; this is an asynchronous operation, i.e. involves a message send. If this method is applied to the self reference from inside an Actor then that Actor is guaranteed to not process any further messages after this call; please note that the processing of the current message will continue, this method does not immediately terminate this actor.
      • stopScheduler

        protected void stopScheduler()
      • systemActorOf

        public ActorRef systemActorOf​(Props props,
                                      java.lang.String name)
        Description copied from class: ExtendedActorSystem
        Create an actor in the "/system" namespace. This actor will be shut down during system.terminate only after all user actors have terminated.

        This is only intended to be used by libraries (and Akka itself). Applications should use ordinary actorOf.

        Specified by:
        systemActorOf in class ExtendedActorSystem
      • terminate

        public scala.concurrent.Future<Terminated> terminate()
        Description copied from class: ActorSystem
        Terminates this actor system by running CoordinatedShutdown with reason CoordinatedShutdown.ActorSystemTerminateReason.

        If akka.coordinated-shutdown.run-by-actor-system-terminate is configured to off it will not run CoordinatedShutdown, but the ActorSystem and its actors will still be terminated.

        This will stop the guardian actor, which in turn will recursively stop all its child actors, and finally the system guardian (below which the logging actors reside) and then execute all registered termination handlers (see ActorSystem.registerOnTermination(scala.Function0<T>)). Be careful to not schedule any operations on completion of the returned future using the dispatcher of this actor system as it will have been shut down before the future completes.

        Specified by:
        terminate in class ActorSystem
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • uncaughtExceptionHandler

        protected java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler()
      • whenTerminated

        public scala.concurrent.Future<Terminated> whenTerminated()
        Description copied from class: ActorSystem
        Returns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed. If you registered any callback with ActorSystem.registerOnTermination(scala.Function0<T>), the returned Future from this method will not complete until all the registered callbacks are finished. Be careful to not schedule any operations, such as onComplete, on the dispatchers (ExecutionContext) of this actor system as they will have been shut down before this future completes.
        Specified by:
        whenTerminated in class ActorSystem