Package akka.actor
Class ActorSystemImpl
- java.lang.Object
-
- akka.actor.ActorSystem
-
- akka.actor.ExtendedActorSystem
-
- akka.actor.ActorSystemImpl
-
- All Implemented Interfaces:
ActorRefFactory,ClassicActorSystemProvider
public class ActorSystemImpl extends ExtendedActorSystem
This is an extension point: by overriding this method, subclasses can control all reflection activities of an actor system.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classActorSystemImpl.TerminationCallbacks<T>Adds a Runnable that will be executed on ActorSystem termination.-
Nested classes/interfaces inherited from class akka.actor.ActorSystem
ActorSystem.Settings
-
-
Constructor Summary
Constructors Constructor 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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActorPath$div(java.lang.String actorName)Construct a path below the application guardian to be used withActorRefFactory.actorSelection(java.lang.String).ActorPath$div(scala.collection.Iterable<java.lang.String> path)Construct a path below the application guardian to be used withActorRefFactory.actorSelection(java.lang.String).voidabort()This kind of shutdown attempts to bring the system down and release its resources more forcefully than plain shutdown.booleanaborting()voidaborting_$eq(boolean x$1)ActorRefactorOf(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).ActorRefactorOf(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 “$”.voidassertInitialized()Asserts that the ActorSystem has been fully initialized.ActorSystemclassicSystem()protected DynamicAccesscreateDynamicAccess()This is an extension point: by overriding this method, subclasses can control all reflection activities of an actor system.protected SchedulercreateScheduler()Create the scheduler service.ActorRefdeadLetters()Actor reference where messages are re-routed to which were addressed to stopped or non-existing actors.scala.concurrent.ExecutionContextExecutordispatcher()Default dispatcher as configured.Dispatchersdispatchers()Helper object for looking up configured dispatchers.DynamicAccessdynamicAccess()ClassLoader wrapper which is used for reflective accesses internally.EventStreameventStream()Main event bus of this actor system, used for example for logging.<T extends Extension>
Textension(ExtensionId<T> ext)Returns the payload that is associated with the provided extension throws an IllegalStateException if it is not registered.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.LocalActorRefguardian()The top-level supervisor of all actors created using system.actorOf(...).scala.Option<Props>guardianProps()booleanhasExtension(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 executionscala.concurrent.ExecutionContextinternalCallingThreadExecutionContext()LoggingAdapterlog()Convenient logging adapter for logging to theActorSystem.eventStream().voidlogConfiguration()Log the configuration.LoggingFilterlogFilter()Filter of log events that is used by the LoggingAdapter before publishing log events to the eventStreamInternalActorReflookupRoot()INTERNAL APIMailboxesmailboxes()Helper object for looking up configured mailbox types.java.lang.Stringname()java.lang.StringprintTree()For debugging: traverse actor hierarchy and make string representation.ActorRefProviderprovider()INTERNAL API<T extends Extension>
TregisterExtension(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 executionvoidregisterOnTermination(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.<T> voidregisterOnTermination(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.Schedulerscheduler()Light-weight scheduler for running asynchronous tasks after some deadline in the future.ActorSystem.Settingssettings()The core settings extracted from the supplied configuration.ActorSystemImplstart()voidstop(ActorRef actor)Stop the actor pointed to by the givenActorRef; this is an asynchronous operation, i.e.protected voidstopScheduler()ActorRefsystemActorOf(Props props, java.lang.String name)Create an actor in the "/system" namespace.LocalActorRefsystemGuardian()The top-level supervisor of all system-internal services like logging.protected ActorSystemImplsystemImpl()INTERNAL APIscala.concurrent.Future<Terminated>terminate()Terminates this actor system.MonitorableThreadFactorythreadFactory()A ThreadFactory that can be used if the transport needs to create any Threadsjava.lang.StringtoString()protected java.lang.Thread.UncaughtExceptionHandleruncaughtExceptionHandler()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 akka.actor.ActorSystem
apply, apply, apply, apply, apply, apply, apply, apply$default$2, apply$default$3, apply$default$4, child, create, create, create, create, create, create, create, descendant, EnvHome, findClassLoader, getDispatcher, getEventStream, getScheduler, GlobalHome, startTime, SystemHome, uptime, Version
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.actor.ActorRefFactory
actorFor, actorFor, actorFor, actorFor, actorSelection, actorSelection
-
-
-
-
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
-
$div
public ActorPath $div(java.lang.String actorName)
Description copied from class:ActorSystemConstruct a path below the application guardian to be used withActorRefFactory.actorSelection(java.lang.String).- Specified by:
$divin classActorSystem- Parameters:
actorName- (undocumented)- Returns:
- (undocumented)
-
$div
public ActorPath $div(scala.collection.Iterable<java.lang.String> path)
Description copied from class:ActorSystemConstruct a path below the application guardian to be used withActorRefFactory.actorSelection(java.lang.String).- Specified by:
$divin classActorSystem- Parameters:
path- (undocumented)- Returns:
- (undocumented)
-
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:ActorRefFactoryCreate new actor as child of this context with the given name, which must not be null, empty or start with “$”. If the given name is already in use, anInvalidActorNameExceptionis thrown.See
Propsfor details on how to obtain aPropsobject.- Parameters:
props- (undocumented)name- (undocumented)- Returns:
- (undocumented)
-
actorOf
public ActorRef actorOf(Props props)
Description copied from interface:ActorRefFactoryCreate 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).See
Propsfor details on how to obtain aPropsobject.- 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.
-
classicSystem
public ActorSystem classicSystem()
-
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:ActorSystemActor 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:
deadLettersin classActorSystem- Returns:
- (undocumented)
-
dispatcher
public scala.concurrent.ExecutionContextExecutor dispatcher()
Description copied from class:ActorSystemDefault 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:
dispatcherin interfaceActorRefFactory- Specified by:
dispatcherin classActorSystem- Returns:
- (undocumented)
-
dispatchers
public Dispatchers dispatchers()
Description copied from class:ActorSystemHelper object for looking up configured dispatchers.- Specified by:
dispatchersin classActorSystem- Returns:
- (undocumented)
-
dynamicAccess
public DynamicAccess dynamicAccess()
Description copied from class:ExtendedActorSystemClassLoader 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:
dynamicAccessin classExtendedActorSystem- Returns:
- (undocumented)
-
eventStream
public EventStream eventStream()
Description copied from class:ActorSystemMain event bus of this actor system, used for example for logging.- Specified by:
eventStreamin classActorSystem- Returns:
- (undocumented)
-
extension
public <T extends Extension> T extension(ExtensionId<T> ext)
Description copied from class:ActorSystemReturns 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:
extensionin classActorSystem- Parameters:
ext- (undocumented)- Returns:
- (undocumented)
-
getWhenTerminated
public java.util.concurrent.CompletionStage<Terminated> getWhenTerminated()
Description copied from class:ActorSystemReturns a CompletionStage which will be completed after the ActorSystem has been terminated and termination hooks have been executed. If you registered any callback withActorSystem.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 thedispatcherof this actor system as it will have been shut down before this future completes.- Specified by:
getWhenTerminatedin classActorSystem- Returns:
- (undocumented)
-
guardian
public LocalActorRef guardian()
Description copied from class:ExtendedActorSystemThe top-level supervisor of all actors created using system.actorOf(...).- Specified by:
guardianin interfaceActorRefFactory- Specified by:
guardianin classExtendedActorSystem- Returns:
- (undocumented)
-
guardianProps
public scala.Option<Props> guardianProps()
-
hasExtension
public boolean hasExtension(ExtensionId<? extends Extension> ext)
Description copied from class:ActorSystemReturns 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:
hasExtensionin classActorSystem- Parameters:
ext- (undocumented)- Returns:
- (undocumented)
-
internalCallingThreadExecutionContext
public scala.concurrent.ExecutionContext internalCallingThreadExecutionContext()
-
log
public LoggingAdapter log()
Description copied from class:ActorSystemConvenient logging adapter for logging to theActorSystem.eventStream().- Specified by:
login classActorSystem- Returns:
- (undocumented)
-
logConfiguration
public void logConfiguration()
Description copied from class:ActorSystemLog the configuration.- Specified by:
logConfigurationin classActorSystem
-
logFilter
public LoggingFilter logFilter()
Description copied from class:ExtendedActorSystemFilter of log events that is used by the LoggingAdapter before publishing log events to the eventStream- Specified by:
logFilterin classExtendedActorSystem- Returns:
- (undocumented)
-
lookupRoot
public InternalActorRef lookupRoot()
Description copied from interface:ActorRefFactoryINTERNAL API- Returns:
- (undocumented)
-
mailboxes
public Mailboxes mailboxes()
Description copied from class:ActorSystemHelper object for looking up configured mailbox types.- Specified by:
mailboxesin classActorSystem- Returns:
- (undocumented)
-
name
public java.lang.String name()
- Specified by:
namein classActorSystem
-
printTree
public java.lang.String printTree()
Description copied from class:ExtendedActorSystemFor 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:
printTreein classExtendedActorSystem- Returns:
- (undocumented)
-
provider
public ActorRefProvider provider()
Description copied from interface:ActorRefFactoryINTERNAL API- Specified by:
providerin interfaceActorRefFactory- Specified by:
providerin classExtendedActorSystem- Returns:
- (undocumented)
-
registerExtension
public final <T extends Extension> T registerExtension(ExtensionId<T> ext)
Description copied from class:ActorSystemRegisters 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:
registerExtensionin classActorSystem- Parameters:
ext- (undocumented)- Returns:
- (undocumented)
-
registerOnTermination
public <T> void registerOnTermination(scala.Function0<T> code)
Description copied from class:ActorSystemRegister 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:
registerOnTerminationin classActorSystem- Parameters:
code- (undocumented)
-
registerOnTermination
public void registerOnTermination(java.lang.Runnable code)
Description copied from class:ActorSystemJava 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:
registerOnTerminationin classActorSystem- Parameters:
code- (undocumented)
-
scheduler
public Scheduler scheduler()
Description copied from class:ActorSystemLight-weight scheduler for running asynchronous tasks after some deadline in the future. Not terribly precise but cheap.- Specified by:
schedulerin classActorSystem- Returns:
- (undocumented)
-
settings
public final ActorSystem.Settings settings()
Description copied from class:ActorSystemThe core settings extracted from the supplied configuration.- Specified by:
settingsin classActorSystem- Returns:
- (undocumented)
-
start
public ActorSystemImpl start()
-
stop
public void stop(ActorRef actor)
Description copied from interface:ActorRefFactoryStop the actor pointed to by the givenActorRef; this is an asynchronous operation, i.e. involves a message send. If this method is applied to theselfreference 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:ExtendedActorSystemCreate an actor in the "/system" namespace. This actor will be shut down during system.terminate only after all user actors have terminated.- Specified by:
systemActorOfin classExtendedActorSystem- Parameters:
props- (undocumented)name- (undocumented)- Returns:
- (undocumented)
-
systemGuardian
public LocalActorRef systemGuardian()
Description copied from class:ExtendedActorSystemThe top-level supervisor of all system-internal services like logging.- Specified by:
systemGuardianin classExtendedActorSystem- Returns:
- (undocumented)
-
systemImpl
protected ActorSystemImpl systemImpl()
Description copied from interface:ActorRefFactoryINTERNAL API- Returns:
- (undocumented)
-
terminate
public scala.concurrent.Future<Terminated> terminate()
Description copied from class:ActorSystemTerminates 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 (seeActorSystem.registerOnTermination(scala.Function0<T>)). Be careful to not schedule any operations on completion of the returned future using thedispatcherof this actor system as it will have been shut down before the future completes.- Specified by:
terminatein classActorSystem- Returns:
- (undocumented)
-
threadFactory
public final MonitorableThreadFactory threadFactory()
Description copied from class:ExtendedActorSystemA ThreadFactory that can be used if the transport needs to create any Threads- Specified by:
threadFactoryin classExtendedActorSystem- Returns:
- (undocumented)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
uncaughtExceptionHandler
protected java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler()
-
whenTerminated
public scala.concurrent.Future<Terminated> whenTerminated()
Description copied from class:ActorSystemReturns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed. If you registered any callback withActorSystem.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 thedispatcherof this actor system as it will have been shut down before this future completes.- Specified by:
whenTerminatedin classActorSystem- Returns:
- (undocumented)
-
-