public class ActorSystemImpl extends ExtendedActorSystem
Modifier and Type | Class and Description |
---|---|
class |
ActorSystemImpl.TerminationCallbacks<T> |
ActorSystem.Settings
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
This kind of shutdown attempts to bring the system down and release its
resources more forcefully than plain shutdown.
|
boolean |
aborting() |
ActorRef |
actorOf(Props props)
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 “$” prepended, may change in the future).
|
ActorRef |
actorOf(Props props,
java.lang.String name)
Create new actor as child of this context with the given name, which must
not be null, empty or start with “$”.
|
void |
awaitTermination()
Block current thread until the system has been shutdown.
|
void |
awaitTermination(scala.concurrent.duration.Duration timeout)
Block current thread until the system has been shutdown, or the specified
timeout has elapsed.
|
protected DynamicAccess |
createDynamicAccess()
This is an extension point: by overriding this method, subclasses can
control all reflection activities of an actor system.
|
protected Scheduler |
createScheduler()
Create the scheduler service.
|
ActorRef |
deadLetters()
Actor reference where messages are re-routed to which were addressed to
stopped or non-existing actors.
|
scala.concurrent.ExecutionContextExecutor |
dispatcher()
Default dispatcher as configured.
|
Dispatchers |
dispatchers()
Helper object for looking up configured dispatchers.
|
DynamicAccess |
dynamicAccess()
ClassLoader wrapper which is used for reflective accesses internally.
|
EventStream |
eventStream()
Main event bus of this actor system, used for example for logging.
|
<T extends Extension> |
extension(ExtensionId<T> ext)
Returns the payload that is associated with the provided extension
throws an IllegalStateException if it is not registered.
|
LocalActorRef |
guardian()
The top-level supervisor of all actors created using system.actorOf(...).
|
scala.Option<Props> |
guardianProps() |
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
|
scala.concurrent.ExecutionContext |
internalCallingThreadExecutionContext() |
boolean |
isTerminated()
Query the termination status: if it returns true, all callbacks have run
and the ActorSystem has been fully stopped, i.e.
|
LoggingAdapter |
log()
Convenient logging adapter for logging to the
ActorSystem.eventStream() . |
void |
logConfiguration()
Log the configuration.
|
LoggingFilter |
logFilter()
Filter of log events that is used by the LoggingAdapter before
publishing log events to the eventStream
|
InternalActorRef |
lookupRoot()
INTERNAL API
|
Mailboxes |
mailboxes()
Helper object for looking up configured mailbox types.
|
java.lang.String |
name()
The name of this actor system, used to distinguish multiple ones within
the same JVM & class loader.
|
java.lang.String |
printTree()
For debugging: traverse actor hierarchy and make string representation.
|
ActorRefProvider |
provider()
The ActorRefProvider is the only entity which creates all actor references within this actor system.
|
<T extends Extension> |
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
|
<T> void |
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.
|
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.
|
Scheduler |
scheduler()
Light-weight scheduler for running asynchronous tasks after some deadline
in the future.
|
ActorSystem.Settings |
settings()
The core settings extracted from the supplied configuration.
|
void |
shutdown()
Stop this actor system.
|
ActorSystemImpl |
start() |
void |
stop(ActorRef actor)
Stop the actor pointed to by the given
ActorRef ; this is
an asynchronous operation, i.e. |
protected void |
stopScheduler() |
ActorRef |
systemActorOf(Props props,
java.lang.String name)
Create an actor in the "/system" namespace.
|
LocalActorRef |
systemGuardian()
The top-level supervisor of all system-internal services like logging.
|
protected ActorSystemImpl |
systemImpl()
INTERNAL API
|
scala.concurrent.Future<Terminated> |
terminate()
Terminates this actor system.
|
MonitorableThreadFactory |
threadFactory()
A ThreadFactory that can be used if the transport needs to create any Threads
|
java.lang.String |
toString() |
protected java.lang.Thread.UncaughtExceptionHandler |
uncaughtExceptionHandler() |
scala.concurrent.Future<Terminated> |
whenTerminated()
Returns a Future which will be completed after the ActorSystem has been terminated
and termination hooks have been executed.
|
actorFor, actorFor, actorFor, actorFor, actorSelection, actorSelection, apply, apply, apply, apply, apply, apply, apply, child, create, create, create, create, create, create, create, descendant, EnvHome, findClassLoader, GlobalHome, startTime, SystemHome, uptime, Version
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
actorFor, actorFor, actorFor, actorFor, actorSelection, actorSelection
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)
public java.lang.String name()
ActorSystem
name
in class ActorSystem
public scala.Option<Props> guardianProps()
public final ActorSystem.Settings settings()
ActorSystem
settings
in class ActorSystem
protected java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler()
public final MonitorableThreadFactory threadFactory()
ExtendedActorSystem
threadFactory
in class ExtendedActorSystem
protected DynamicAccess createDynamicAccess()
public DynamicAccess dynamicAccess()
ExtendedActorSystem
dynamicAccess
in class ExtendedActorSystem
public void logConfiguration()
ActorSystem
logConfiguration
in class ActorSystem
protected ActorSystemImpl systemImpl()
ActorRefFactory
systemImpl
in interface ActorRefFactory
systemImpl
in class ActorSystem
public ActorRef systemActorOf(Props props, java.lang.String name)
ExtendedActorSystem
systemActorOf
in class ExtendedActorSystem
props
- (undocumented)name
- (undocumented)public ActorRef actorOf(Props props, java.lang.String name)
ActorRefFactory
InvalidActorNameException
is thrown.
See Props
for details on how to obtain a Props
object.
actorOf
in interface ActorRefFactory
actorOf
in class ActorSystem
props
- (undocumented)name
- (undocumented)public ActorRef actorOf(Props props)
ActorRefFactory
See Props
for details on how to obtain a Props
object.
actorOf
in interface ActorRefFactory
actorOf
in class ActorSystem
props
- (undocumented)public void stop(ActorRef actor)
ActorRefFactory
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.stop
in interface ActorRefFactory
stop
in class ActorSystem
actor
- (undocumented)public EventStream eventStream()
ActorSystem
eventStream
in class ActorSystem
public LoggingFilter logFilter()
ExtendedActorSystem
logFilter
in class ExtendedActorSystem
public LoggingAdapter log()
ActorSystem
ActorSystem.eventStream()
.log
in class ActorSystem
public Scheduler scheduler()
ActorSystem
scheduler
in class ActorSystem
public ActorRefProvider provider()
ExtendedActorSystem
provider
in interface ActorRefFactory
provider
in class ExtendedActorSystem
public ActorRef deadLetters()
ActorSystem
deadLetters
in class ActorSystem
public Mailboxes mailboxes()
ActorSystem
mailboxes
in class ActorSystem
public Dispatchers dispatchers()
ActorSystem
dispatchers
in class ActorSystem
public scala.concurrent.ExecutionContextExecutor dispatcher()
ActorSystem
dispatcher
in interface ActorRefFactory
dispatcher
in class ActorSystem
public scala.concurrent.ExecutionContext internalCallingThreadExecutionContext()
public scala.concurrent.Future<Terminated> whenTerminated()
ActorSystem
dispatcher
of this actor system as it will have been shut down before this
future completes.whenTerminated
in class ActorSystem
public InternalActorRef lookupRoot()
ActorRefFactory
lookupRoot
in interface ActorRefFactory
lookupRoot
in class ActorSystem
public LocalActorRef guardian()
ExtendedActorSystem
guardian
in interface ActorRefFactory
guardian
in class ExtendedActorSystem
public LocalActorRef systemGuardian()
ExtendedActorSystem
systemGuardian
in class ExtendedActorSystem
public ActorSystemImpl start()
public <T> void registerOnTermination(scala.Function0<T> code)
ActorSystem
Throws a RejectedExecutionException if the System has already shut down or if shutdown has been initiated.
Scala API
registerOnTermination
in class ActorSystem
code
- (undocumented)public void registerOnTermination(java.lang.Runnable code)
ActorSystem
Throws a RejectedExecutionException if the System has already shut down or if shutdown has been initiated.
registerOnTermination
in class ActorSystem
code
- (undocumented)public void awaitTermination(scala.concurrent.duration.Duration timeout)
ActorSystem
Throws TimeoutException in case of timeout.
awaitTermination
in class ActorSystem
timeout
- (undocumented)public void awaitTermination()
ActorSystem
awaitTermination
in class ActorSystem
public boolean isTerminated()
ActorSystem
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.isTerminated
in class ActorSystem
public void shutdown()
ActorSystem
ActorSystem.registerOnTermination(scala.Function0<T>)
).shutdown
in class ActorSystem
public scala.concurrent.Future<Terminated> terminate()
ActorSystem
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.terminate
in class ActorSystem
public boolean aborting()
public void abort()
protected Scheduler createScheduler()
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.
protected void stopScheduler()
public final <T extends Extension> T registerExtension(ExtensionId<T> ext)
ActorSystem
registerExtension
in class ActorSystem
ext
- (undocumented)public <T extends Extension> T extension(ExtensionId<T> ext)
ActorSystem
extension
in class ActorSystem
ext
- (undocumented)public boolean hasExtension(ExtensionId<? extends Extension> ext)
ActorSystem
hasExtension
in class ActorSystem
ext
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printTree()
ExtendedActorSystem
printTree
in class ExtendedActorSystem