Package akka.actor

Class ActorSystem

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ActorSystem.Settings
      The backing Config of this ActorSystem's Settings
    • Constructor Summary

      Constructors 
      Constructor Description
      ActorSystem()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract ActorPath $div​(java.lang.String name)
      Construct a path below the application guardian to be used with ActorRefFactory.actorSelection(java.lang.String).
      abstract ActorPath $div​(scala.collection.Iterable<java.lang.String> name)
      Construct a path below the application guardian to be used with ActorRefFactory.actorSelection(java.lang.String).
      static ActorSystem apply()
      Creates a new ActorSystem with the name "default", obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem apply​(java.lang.String name)
      Creates a new ActorSystem with the specified name, obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem apply​(java.lang.String name, BootstrapSetup bootstrapSetup)
      Scala API: Shortcut for creating an actor system with custom bootstrap settings.
      static ActorSystem apply​(java.lang.String name, ActorSystemSetup setup)
      Scala API: Creates a new actor system with the specified name and settings The core actor system settings are defined in BootstrapSetup
      static ActorSystem apply​(java.lang.String name, com.typesafe.config.Config config)
      Creates a new ActorSystem with the specified name, and the specified Config, then obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem apply​(java.lang.String name, com.typesafe.config.Config config, java.lang.ClassLoader classLoader)
      Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader
      static ActorSystem apply​(java.lang.String name, scala.Option<com.typesafe.config.Config> config, scala.Option<java.lang.ClassLoader> classLoader, scala.Option<scala.concurrent.ExecutionContext> defaultExecutionContext)
      Creates a new ActorSystem with the specified name, the specified ClassLoader if given, otherwise obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static scala.Option<com.typesafe.config.Config> apply$default$2()  
      static scala.Option<java.lang.ClassLoader> apply$default$3()  
      static scala.Option<scala.concurrent.ExecutionContext> apply$default$4()  
      ActorPath child​(java.lang.String child)
      Java API: Create a new child actor path.
      static ActorSystem create()
      Creates a new ActorSystem with the name "default", obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem create​(java.lang.String name)
      Creates a new ActorSystem with the specified name, obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem create​(java.lang.String name, BootstrapSetup bootstrapSetup)
      Java API: Shortcut for creating an actor system with custom bootstrap settings.
      static ActorSystem create​(java.lang.String name, ActorSystemSetup setups)
      Java API: Creates a new actor system with the specified name and settings The core actor system settings are defined in BootstrapSetup
      static ActorSystem create​(java.lang.String name, com.typesafe.config.Config config)
      Creates a new ActorSystem with the specified name, and the specified Config, then obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.
      static ActorSystem create​(java.lang.String name, com.typesafe.config.Config config, java.lang.ClassLoader classLoader)
      Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader
      static ActorSystem create​(java.lang.String name, com.typesafe.config.Config config, java.lang.ClassLoader classLoader, scala.concurrent.ExecutionContext defaultExecutionContext)
      Creates a new ActorSystem with the specified name, the specified Config, the specified ClassLoader, and the specified ExecutionContext.
      abstract ActorRef deadLetters()
      Actor reference where messages are re-routed to which were addressed to stopped or non-existing actors.
      ActorPath descendant​(java.lang.Iterable<java.lang.String> names)
      Java API: Recursively create a descendant&rsquo;s path by appending all child names.
      abstract scala.concurrent.ExecutionContextExecutor dispatcher()
      Default dispatcher as configured.
      abstract Dispatchers dispatchers()
      Helper object for looking up configured dispatchers.
      static scala.Option<java.lang.String> EnvHome()  
      abstract EventStream eventStream()
      Main event bus of this actor system, used for example for logging.
      abstract <T extends Extension>
      T
      extension​(ExtensionId<T> ext)
      Returns the payload that is associated with the provided extension throws an IllegalStateException if it is not registered.
      static java.lang.ClassLoader findClassLoader()  
      scala.concurrent.ExecutionContextExecutor getDispatcher()
      Java API: Default dispatcher as configured.
      EventStream getEventStream()
      Java API: Main event bus of this actor system, used for example for logging.
      Scheduler getScheduler()
      Java API: Light-weight scheduler for running asynchronous tasks after some deadline in the future.
      abstract java.util.concurrent.CompletionStage<Terminated> getWhenTerminated()
      Returns a CompletionStage which will be completed after the ActorSystem has been terminated and termination hooks have been executed.
      static scala.Option<java.lang.String> GlobalHome()  
      abstract boolean hasExtension​(ExtensionId<? extends Extension> ext)
      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
      abstract LoggingAdapter log()
      Convenient logging adapter for logging to the eventStream().
      abstract void logConfiguration()
      Log the configuration.
      abstract Mailboxes mailboxes()
      Helper object for looking up configured mailbox types.
      abstract java.lang.String name()  
      abstract <T extends Extension>
      T
      registerExtension​(ExtensionId<T> ext)
      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
      abstract void registerOnTermination​(java.lang.Runnable code)
      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.
      abstract <T> void registerOnTermination​(scala.Function0<T> code)
      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.
      abstract Scheduler scheduler()
      Light-weight scheduler for running asynchronous tasks after some deadline in the future.
      abstract ActorSystem.Settings settings()
      The core settings extracted from the supplied configuration.
      long startTime()
      Start-up time in milliseconds since the epoch.
      static scala.Option<java.lang.String> SystemHome()  
      abstract scala.concurrent.Future<Terminated> terminate()
      Terminates this actor system.
      long uptime()
      Up-time of this actor system in seconds.
      static java.lang.String Version()  
      abstract scala.concurrent.Future<Terminated> whenTerminated()
      Returns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ActorSystem

        public ActorSystem()
    • Method Detail

      • Version

        public static java.lang.String Version()
      • EnvHome

        public static scala.Option<java.lang.String> EnvHome()
      • SystemHome

        public static scala.Option<java.lang.String> SystemHome()
      • GlobalHome

        public static scala.Option<java.lang.String> GlobalHome()
      • create

        public static ActorSystem create()
        Creates a new ActorSystem with the name "default", obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. Then it loads the default reference configuration using the ClassLoader.
        Returns:
        (undocumented)
      • create

        public static ActorSystem create​(java.lang.String name)
        Creates a new ActorSystem with the specified name, obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. Then it loads the default reference configuration using the ClassLoader.
        Parameters:
        name - (undocumented)
        Returns:
        (undocumented)
      • create

        public static ActorSystem create​(java.lang.String name,
                                         ActorSystemSetup setups)
        Java API: Creates a new actor system with the specified name and settings The core actor system settings are defined in BootstrapSetup
        Parameters:
        name - (undocumented)
        setups - (undocumented)
        Returns:
        (undocumented)
      • create

        public static ActorSystem create​(java.lang.String name,
                                         BootstrapSetup bootstrapSetup)
        Java API: Shortcut for creating an actor system with custom bootstrap settings. Same behavior as calling ActorSystem.create(name, ActorSystemSetup.create(bootstrapSettings))
        Parameters:
        name - (undocumented)
        bootstrapSetup - (undocumented)
        Returns:
        (undocumented)
      • create

        public static ActorSystem create​(java.lang.String name,
                                         com.typesafe.config.Config config)
        Creates a new ActorSystem with the specified name, and the specified Config, then obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.

        Parameters:
        name - (undocumented)
        config - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • create

        public static ActorSystem create​(java.lang.String name,
                                         com.typesafe.config.Config config,
                                         java.lang.ClassLoader classLoader)
        Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader

        Parameters:
        name - (undocumented)
        config - (undocumented)
        classLoader - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • create

        public static ActorSystem create​(java.lang.String name,
                                         com.typesafe.config.Config config,
                                         java.lang.ClassLoader classLoader,
                                         scala.concurrent.ExecutionContext defaultExecutionContext)
        Creates a new ActorSystem with the specified name, the specified Config, the specified ClassLoader, and the specified ExecutionContext. The ExecutionContext will be used as the default executor inside this ActorSystem. If null is passed in for the Config, ClassLoader and/or ExecutionContext parameters, the respective default value will be used. If no Config is given, the default reference config will be obtained from the ClassLoader. If no ClassLoader is given, it obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. If no ExecutionContext is given, the system will fallback to the executor configured under "akka.actor.default-dispatcher.default-executor.fallback". Note that the given ExecutionContext will be used by all dispatchers that have been configured with executor = "default-executor", including those that have not defined the executor setting and thereby fallback to the default of "default-dispatcher.executor".

        Parameters:
        name - (undocumented)
        config - (undocumented)
        classLoader - (undocumented)
        defaultExecutionContext - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • apply

        public static ActorSystem apply()
        Creates a new ActorSystem with the name "default", obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. Then it loads the default reference configuration using the ClassLoader.
        Returns:
        (undocumented)
      • apply

        public static ActorSystem apply​(java.lang.String name)
        Creates a new ActorSystem with the specified name, obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. Then it loads the default reference configuration using the ClassLoader.
        Parameters:
        name - (undocumented)
        Returns:
        (undocumented)
      • apply

        public static ActorSystem apply​(java.lang.String name,
                                        ActorSystemSetup setup)
        Scala API: Creates a new actor system with the specified name and settings The core actor system settings are defined in BootstrapSetup
        Parameters:
        name - (undocumented)
        setup - (undocumented)
        Returns:
        (undocumented)
      • apply

        public static ActorSystem apply​(java.lang.String name,
                                        BootstrapSetup bootstrapSetup)
        Scala API: Shortcut for creating an actor system with custom bootstrap settings. Same behavior as calling ActorSystem(name, ActorSystemSetup(bootstrapSetup))
        Parameters:
        name - (undocumented)
        bootstrapSetup - (undocumented)
        Returns:
        (undocumented)
      • apply

        public static ActorSystem apply​(java.lang.String name,
                                        com.typesafe.config.Config config)
        Creates a new ActorSystem with the specified name, and the specified Config, then obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class.

        Parameters:
        name - (undocumented)
        config - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • apply

        public static ActorSystem apply​(java.lang.String name,
                                        com.typesafe.config.Config config,
                                        java.lang.ClassLoader classLoader)
        Creates a new ActorSystem with the specified name, the specified Config, and specified ClassLoader

        Parameters:
        name - (undocumented)
        config - (undocumented)
        classLoader - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • apply

        public static ActorSystem apply​(java.lang.String name,
                                        scala.Option<com.typesafe.config.Config> config,
                                        scala.Option<java.lang.ClassLoader> classLoader,
                                        scala.Option<scala.concurrent.ExecutionContext> defaultExecutionContext)
        Creates a new ActorSystem with the specified name, the specified ClassLoader if given, otherwise obtains the current ClassLoader by first inspecting the current threads' getContextClassLoader, then tries to walk the stack to find the callers class loader, then falls back to the ClassLoader associated with the ActorSystem class. If an ExecutionContext is given, it will be used as the default executor inside this ActorSystem. If no ExecutionContext is given, the system will fallback to the executor configured under "akka.actor.default-dispatcher.default-executor.fallback". The system will use the passed in config, or falls back to the default reference configuration using the ClassLoader.

        Parameters:
        name - (undocumented)
        config - (undocumented)
        classLoader - (undocumented)
        defaultExecutionContext - (undocumented)
        Returns:
        (undocumented)
        See Also:
        The Typesafe Config Library API Documentation
      • apply$default$2

        public static scala.Option<com.typesafe.config.Config> apply$default$2()
      • apply$default$3

        public static scala.Option<java.lang.ClassLoader> apply$default$3()
      • apply$default$4

        public static scala.Option<scala.concurrent.ExecutionContext> apply$default$4()
      • findClassLoader

        public static java.lang.ClassLoader findClassLoader()
      • name

        public abstract java.lang.String name()
      • settings

        public abstract ActorSystem.Settings settings()
        The core settings extracted from the supplied configuration.
        Returns:
        (undocumented)
      • logConfiguration

        public abstract void logConfiguration()
        Log the configuration.
      • child

        public ActorPath child​(java.lang.String child)
        Java API: Create a new child actor path.
        Parameters:
        child - (undocumented)
        Returns:
        (undocumented)
      • descendant

        public ActorPath descendant​(java.lang.Iterable<java.lang.String> names)
        Java API: Recursively create a descendant&rsquo;s path by appending all child names.
        Parameters:
        names - (undocumented)
        Returns:
        (undocumented)
      • startTime

        public long startTime()
        Start-up time in milliseconds since the epoch.
        Returns:
        (undocumented)
      • uptime

        public long uptime()
        Up-time of this actor system in seconds.
        Returns:
        (undocumented)
      • eventStream

        public abstract EventStream eventStream()
        Main event bus of this actor system, used for example for logging.
        Returns:
        (undocumented)
      • getEventStream

        public EventStream getEventStream()
        Java API: Main event bus of this actor system, used for example for logging.
        Returns:
        (undocumented)
      • deadLetters

        public abstract ActorRef deadLetters()
        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.
        Returns:
        (undocumented)
      • scheduler

        public abstract Scheduler scheduler()
        Light-weight scheduler for running asynchronous tasks after some deadline in the future. Not terribly precise but cheap.
        Returns:
        (undocumented)
      • getScheduler

        public Scheduler getScheduler()
        Java API: Light-weight scheduler for running asynchronous tasks after some deadline in the future. Not terribly precise but cheap.
        Returns:
        (undocumented)
      • dispatchers

        public abstract Dispatchers dispatchers()
        Helper object for looking up configured dispatchers.
        Returns:
        (undocumented)
      • dispatcher

        public abstract scala.concurrent.ExecutionContextExecutor dispatcher()
        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
        Returns:
        (undocumented)
      • getDispatcher

        public scala.concurrent.ExecutionContextExecutor getDispatcher()
        Java API: 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.
        Returns:
        (undocumented)
      • mailboxes

        public abstract Mailboxes mailboxes()
        Helper object for looking up configured mailbox types.
        Returns:
        (undocumented)
      • registerOnTermination

        public abstract <T> void registerOnTermination​(scala.Function0<T> code)
        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

        Parameters:
        code - (undocumented)
      • registerOnTermination

        public abstract void registerOnTermination​(java.lang.Runnable code)
        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.

        Parameters:
        code - (undocumented)
      • terminate

        public abstract scala.concurrent.Future<Terminated> terminate()
        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 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.
        Returns:
        (undocumented)
      • whenTerminated

        public abstract scala.concurrent.Future<Terminated> whenTerminated()
        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 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.
        Returns:
        (undocumented)
      • getWhenTerminated

        public abstract java.util.concurrent.CompletionStage<Terminated> getWhenTerminated()
        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 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.
        Returns:
        (undocumented)
      • registerExtension

        public abstract <T extends Extension> T registerExtension​(ExtensionId<T> ext)
        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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)
      • extension

        public abstract <T extends Extension> T extension​(ExtensionId<T> ext)
        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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)
      • hasExtension

        public abstract boolean hasExtension​(ExtensionId<? extends Extension> ext)
        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
        Parameters:
        ext - (undocumented)
        Returns:
        (undocumented)