|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object akka.actor.ActorSystem
public abstract class ActorSystem
An actor system is a hierarchical group of actors which share common configuration, e.g. dispatchers, deployments, remote capabilities and addresses. It is also the entry point for creating or looking up actors.
There are several possibilities for creating actors (see Props
for details on props
):
// Java or Scala
system.actorOf(props, "name")
system.actorOf(props)
// Scala
system.actorOf(Props[MyActor], "name")
system.actorOf(Props(classOf[MyActor], arg1, arg2), "name")
// Java
system.actorOf(Props.create(MyActor.class), "name");
system.actorOf(Props.create(MyActor.class, arg1, arg2), "name");
Where no name is given explicitly, one will be automatically generated.
Important Notice:
This class is not meant to be extended by user code. If you want to
actually roll your own Akka, it will probably be better to look into
extending ExtendedActorSystem
instead, but beware that you
are completely on your own in that case!
Nested Class Summary | |
---|---|
static class |
ActorSystem.Settings
Settings are the overall ActorSystem Settings which also provides a convenient access to the Config object. |
Constructor Summary | |
---|---|
ActorSystem()
|
Method Summary | ||
---|---|---|
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,
com.typesafe.config.Config config)
Creates a new ActorSystem with the name "default", 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 name "default", the specified Config, and specified ClassLoader |
|
abstract void |
awaitTermination()
Block current thread until the system has been shutdown. |
|
abstract void |
awaitTermination(scala.concurrent.duration.Duration timeout)
Block current thread until the system has been shutdown, or the specified timeout has elapsed. |
|
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,
com.typesafe.config.Config config)
Creates a new ActorSystem with the name "default", 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 name "default", the specified Config, and specified ClassLoader |
|
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’s path by appending all child names. |
|
abstract scala.concurrent.ExecutionContext |
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
|
extension(ExtensionId<T> ext)
Returns the payload that is associated with the provided extension throws an IllegalStateException if it is not registered. |
|
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 boolean |
isTerminated()
Query the termination status: if it returns true, all callbacks have run and the ActorSystem has been fully stopped, i.e. |
|
abstract LoggingAdapter |
log()
Convenient logging adapter for logging to the ActorSystem.eventStream . |
|
abstract void |
logConfiguration()
Log the configuration. |
|
abstract akka.dispatch.Mailboxes |
mailboxes()
Helper object for looking up configured mailbox types. |
|
abstract java.lang.String |
name()
The name of this actor system, used to distinguish multiple ones within the same JVM & class loader. |
|
abstract
|
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
|
registerOnTermination(scala.Function0<T> code)
Register a block of code (callback) to run after ActorSystem.shutdown has been issued and all actors in this actor system have been stopped. |
|
abstract void |
registerOnTermination(java.lang.Runnable code)
Java API: Register a block of code (callback) to run after ActorSystem.shutdown 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. |
|
abstract void |
shutdown()
Stop this actor system. |
|
long |
startTime()
Start-up time in milliseconds since the epoch. |
|
static scala.Option<java.lang.String> |
SystemHome()
|
|
long |
uptime()
Up-time of this actor system in seconds. |
|
static java.lang.String |
Version()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface akka.actor.ActorRefFactory |
---|
actorFor, actorFor, actorFor, actorFor, actorOf, actorOf, actorSelection, actorSelection, guardian, lookupRoot, provider, stop, systemImpl |
Constructor Detail |
---|
public ActorSystem()
Method Detail |
---|
public static java.lang.String Version()
public static scala.Option<java.lang.String> EnvHome()
public static scala.Option<java.lang.String> SystemHome()
public static scala.Option<java.lang.String> GlobalHome()
public static ActorSystem create()
public static ActorSystem create(java.lang.String name)
public static ActorSystem create(java.lang.String name, com.typesafe.config.Config config)
public static ActorSystem create(java.lang.String name, com.typesafe.config.Config config, java.lang.ClassLoader classLoader)
public static ActorSystem apply()
public static ActorSystem apply(java.lang.String name)
public static ActorSystem apply(java.lang.String name, com.typesafe.config.Config config)
public static ActorSystem apply(java.lang.String name, com.typesafe.config.Config config, java.lang.ClassLoader classLoader)
public abstract java.lang.String name()
public abstract ActorSystem.Settings settings()
public abstract void logConfiguration()
public ActorPath child(java.lang.String child)
public ActorPath descendant(java.lang.Iterable<java.lang.String> names)
public long startTime()
public long uptime()
public abstract EventStream eventStream()
public abstract LoggingAdapter log()
ActorSystem.eventStream
.
public abstract ActorRef deadLetters()
public abstract Scheduler scheduler()
public abstract Dispatchers dispatchers()
public abstract scala.concurrent.ExecutionContext dispatcher()
dispatcher
in interface ActorRefFactory
public abstract akka.dispatch.Mailboxes mailboxes()
public abstract <T> void registerOnTermination(scala.Function0<T> code)
a
- RejectedExecutionException if the System has already shut down or if shutdown has been initiated.
Scala API
public abstract void registerOnTermination(java.lang.Runnable code)
a
- RejectedExecutionException if the System has already shut down or if shutdown has been initiated.public abstract void awaitTermination(scala.concurrent.duration.Duration timeout)
TimeoutException
- in case of timeoutpublic abstract void awaitTermination()
public abstract void shutdown()
ActorSystem.registerOnTermination
).
public abstract boolean isTerminated()
awaitTermination(0 seconds)
would return normally. If this method
returns false
, the status is actually unknown, since it might have
changed since you queried it.
public abstract <T extends Extension> T registerExtension(ExtensionId<T> ext)
public abstract <T extends Extension> T extension(ExtensionId<T> ext)
public abstract boolean hasExtension(ExtensionId<? extends Extension> ext)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |