Package akka.actor

Class ActorSystemImpl

  • All Implemented Interfaces:
    ActorRefFactory

    public class ActorSystemImpl
    extends ExtendedActorSystem
    This is an extension point: by overriding this method, subclasses can control all reflection activities of an actor system.
    • 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 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.

        Parameters:
        props - (undocumented)
        name - (undocumented)
        Returns:
        (undocumented)
      • 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.

        Parameters:
        props - (undocumented)
        Returns:
        (undocumented)
      • 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.
      • createDynamicAccess

        protected DynamicAccess createDynamicAccess()
        This is an extension point: by overriding this method, subclasses can control all reflection activities of an actor system.
        Returns:
        (undocumented)
      • 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.

        Returns:
        (undocumented)
      • 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
        Returns:
        (undocumented)
      • 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
        Returns:
        (undocumented)
      • 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
        Returns:
        (undocumented)
      • eventStream

        public EventStream eventStream()
        Description copied from class: ActorSystem
        Main event bus of this actor system, used for example for logging.
        Specified by:
        eventStream in class ActorSystem
        Returns:
        (undocumented)
      • 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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)
      • 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 on the dispatcher of this actor system as it will have been shut down before this future completes.
        Specified by:
        getWhenTerminated in class ActorSystem
        Returns:
        (undocumented)
      • 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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)
      • internalCallingThreadExecutionContext

        public scala.concurrent.ExecutionContext internalCallingThreadExecutionContext()
      • mailboxes

        public Mailboxes mailboxes()
        Description copied from class: ActorSystem
        Helper object for looking up configured mailbox types.
        Specified by:
        mailboxes in class ActorSystem
        Returns:
        (undocumented)
      • name

        public java.lang.String name()
        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
        Returns:
        (undocumented)
      • 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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)
      • registerOnTermination

        public <T> void registerOnTermination​(scala.Function0<T> code)
        Description copied from class: ActorSystem
        Register a block of code (callback) to run after {@link 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
        Parameters:
        code - (undocumented)
      • registerOnTermination

        public void registerOnTermination​(java.lang.Runnable code)
        Description copied from class: ActorSystem
        Java API: Register a block of code (callback) to run after {@link 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
        Parameters:
        code - (undocumented)
      • 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
        Returns:
        (undocumented)
      • 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.
        Parameters:
        actor - (undocumented)
      • 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.
        Specified by:
        systemActorOf in class ExtendedActorSystem
        Parameters:
        props - (undocumented)
        name - (undocumented)
        Returns:
        (undocumented)
      • terminate

        public scala.concurrent.Future<Terminated> terminate()
        Description copied from class: ActorSystem
        Terminates this actor system. This will stop the guardian actor, which in turn will recursively stop all its child actors, 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
        Returns:
        (undocumented)
      • 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 on the dispatcher of this actor system as it will have been shut down before this future completes.
        Specified by:
        whenTerminated in class ActorSystem
        Returns:
        (undocumented)