Package akka.actor.typed
Class ActorSystem<T>
- java.lang.Object
-
- akka.actor.typed.ActorSystem<T>
-
- All Implemented Interfaces:
ClassicActorSystemProvider
,ActorRef<T>
,Extensions
,RecipientRef<T>
,java.io.Serializable
,java.lang.Comparable<ActorRef<?>>
- Direct Known Subclasses:
ActorSystemAdapter
,ActorSystemStub
public abstract class ActorSystem<T> extends java.lang.Object implements ActorRef<T>, Extensions, ClassicActorSystemProvider
The name of this actor system, used to distinguish multiple ones within the same JVM & class loader.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.actor.typed.ActorRef
ActorRef.ActorRefOps<T>, ActorRef.ActorRefOps$
-
Nested classes/interfaces inherited from interface akka.actor.typed.RecipientRef
RecipientRef.RecipientRefOps<T>, RecipientRef.RecipientRefOps$
-
-
Constructor Summary
Constructors Constructor Description ActorSystem()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T> ActorSystem<T>
apply(Behavior<T> guardianBehavior, java.lang.String name)
static <T> ActorSystem<T>
apply(Behavior<T> guardianBehavior, java.lang.String name, BootstrapSetup bootstrapSetup)
Scala API: Shortcut for creating an actor system with custom bootstrap settings.static <T> ActorSystem<T>
apply(Behavior<T> guardianBehavior, java.lang.String name, ActorSystemSetup setup, Props guardianProps)
Scala API: Creates a new actor system with the specified name and settings The core actor system settings are defined inBootstrapSetup
static <T> ActorSystem<T>
apply(Behavior<T> guardianBehavior, java.lang.String name, com.typesafe.config.Config config)
Scala API: Create an ActorSystemstatic <T> Props
apply$default$4()
static <T> ActorSystem<T>
create(Behavior<T> guardianBehavior, java.lang.String name)
Java API: Create an ActorSystemstatic <T> ActorSystem<T>
create(Behavior<T> guardianBehavior, java.lang.String name, BootstrapSetup bootstrapSetup)
Java API: Shortcut for creating an actor system with custom bootstrap settings.static <T> ActorSystem<T>
create(Behavior<T> guardianBehavior, 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 inBootstrapSetup
static <T> ActorSystem<T>
create(Behavior<T> guardianBehavior, java.lang.String name, com.typesafe.config.Config config)
Java API: Create an ActorSystemabstract <U> ActorRef<U>
deadLetters()
The deadLetter address is a destination that will accept (and discard) every message sent to it.abstract Dispatchers
dispatchers()
Facilities for lookup up thread-pools from configuration.abstract DynamicAccess
dynamicAccess()
ClassLoader wrapper which is used for reflective accesses internally.abstract scala.concurrent.ExecutionContextExecutor
executionContext()
The default thread pool of this ActorSystem, configured with settings inakka.actor.default-dispatcher
.abstract java.util.concurrent.CompletionStage<Done>
getWhenTerminated()
Java API: Returns a CompletionStage which will be completed after the ActorSystem has been terminated and termination hooks have been executed.abstract Logger
log()
ALogger
that can be used to emit log messages without specifying a more detailed source.abstract void
logConfiguration()
Log the configuration.abstract java.lang.String
name()
abstract java.lang.String
printTree()
Create a string representation of the actor hierarchy within this system for debugging purposes.ActorRef<Receptionist.Command>
receptionist()
Return a reference to this system’sReceptionist
.abstract Scheduler
scheduler()
A generic scheduler that can initiate the execution of tasks after some delay.abstract Settings
settings()
The core settings extracted from the supplied configuration.abstract long
startTime()
Start-up time in milliseconds since the epoch.abstract <U> scala.concurrent.Future<ActorRef<U>>
systemActorOf(Behavior<U> behavior, java.lang.String name, Props props, Timeout timeout)
Create an actor in the "/system" namespace.<U> Props
systemActorOf$default$3()
abstract void
terminate()
Terminates this actor system.abstract java.util.concurrent.ThreadFactory
threadFactory()
A ThreadFactory that can be used if the transport needs to create any Threadsabstract long
uptime()
Up-time of this actor system in seconds.abstract scala.concurrent.Future<Done>
whenTerminated()
Scala API: Returns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed.static ActorSystem<scala.runtime.Nothing$>
wrap(ActorSystem system)
Wrap an untypedActorSystem
such that it can be used from Akka TypedBehavior
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.typed.ActorRef
narrow, path, tell, unsafeUpcast, writeReplace
-
Methods inherited from interface akka.actor.ClassicActorSystemProvider
classicSystem
-
Methods inherited from interface akka.actor.typed.Extensions
extension, hasExtension, registerExtension
-
-
-
-
Method Detail
-
apply
public static <T> ActorSystem<T> apply(Behavior<T> guardianBehavior, java.lang.String name)
-
apply
public static <T> ActorSystem<T> apply(Behavior<T> guardianBehavior, java.lang.String name, com.typesafe.config.Config config)
Scala API: Create an ActorSystem- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)config
- (undocumented)- Returns:
- (undocumented)
-
apply
public static <T> ActorSystem<T> apply(Behavior<T> guardianBehavior, java.lang.String name, ActorSystemSetup setup, Props guardianProps)
Scala API: Creates a new actor system with the specified name and settings The core actor system settings are defined inBootstrapSetup
- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)setup
- (undocumented)guardianProps
- (undocumented)- Returns:
- (undocumented)
-
apply
public static <T> ActorSystem<T> apply(Behavior<T> guardianBehavior, java.lang.String name, BootstrapSetup bootstrapSetup)
Scala API: Shortcut for creating an actor system with custom bootstrap settings. Same behavior as callingActorSystem(name, ActorSystemSetup(bootstrapSetup))
- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)bootstrapSetup
- (undocumented)- Returns:
- (undocumented)
-
apply$default$4
public static <T> Props apply$default$4()
-
create
public static <T> ActorSystem<T> create(Behavior<T> guardianBehavior, java.lang.String name)
Java API: Create an ActorSystem- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T> ActorSystem<T> create(Behavior<T> guardianBehavior, java.lang.String name, com.typesafe.config.Config config)
Java API: Create an ActorSystem- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)config
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T> ActorSystem<T> create(Behavior<T> guardianBehavior, 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 inBootstrapSetup
- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)setups
- (undocumented)- Returns:
- (undocumented)
-
create
public static <T> ActorSystem<T> create(Behavior<T> guardianBehavior, java.lang.String name, BootstrapSetup bootstrapSetup)
Java API: Shortcut for creating an actor system with custom bootstrap settings. Same behavior as callingActorSystem.create(name, ActorSystemSetup.create(bootstrapSettings))
- Parameters:
guardianBehavior
- (undocumented)name
- (undocumented)bootstrapSetup
- (undocumented)- Returns:
- (undocumented)
-
wrap
public static ActorSystem<scala.runtime.Nothing$> wrap(ActorSystem system)
Wrap an untypedActorSystem
such that it can be used from Akka TypedBehavior
.- Parameters:
system
- (undocumented)- Returns:
- (undocumented)
-
name
public abstract java.lang.String name()
-
settings
public abstract Settings settings()
The core settings extracted from the supplied configuration.- Returns:
- (undocumented)
-
logConfiguration
public abstract void logConfiguration()
Log the configuration.
-
log
public abstract Logger log()
ALogger
that can be used to emit log messages without specifying a more detailed source. Typically it is desirable to use the dedicatedLogger
available from each Actor’sTypedActorContext
as that ties the log entries to the actor.- Returns:
- (undocumented)
-
startTime
public abstract long startTime()
Start-up time in milliseconds since the epoch.- Returns:
- (undocumented)
-
uptime
public abstract long uptime()
Up-time of this actor system in seconds.- Returns:
- (undocumented)
-
threadFactory
public abstract java.util.concurrent.ThreadFactory threadFactory()
A ThreadFactory that can be used if the transport needs to create any Threads- Returns:
- (undocumented)
-
dynamicAccess
public abstract DynamicAccess dynamicAccess()
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.- Returns:
- (undocumented)
-
scheduler
public abstract Scheduler scheduler()
A generic scheduler that can initiate the execution of tasks after some delay. It is recommended to use the ActorContext’s scheduling capabilities for sending messages to actors instead of registering a Runnable for execution using this facility.- Returns:
- (undocumented)
-
dispatchers
public abstract Dispatchers dispatchers()
Facilities for lookup up thread-pools from configuration.- Returns:
- (undocumented)
-
executionContext
public abstract scala.concurrent.ExecutionContextExecutor executionContext()
The default thread pool of this ActorSystem, configured with settings inakka.actor.default-dispatcher
.- Returns:
- (undocumented)
-
terminate
public abstract void terminate()
Terminates this actor system. This will stop the guardian actor, which in turn will recursively stop all its child actors, then the system guardian (below which the logging actors reside).This is an asynchronous operation and completion of the termination can be observed with
ActorSystem.whenTerminated
orActorSystem.getWhenTerminated
.
-
whenTerminated
public abstract scala.concurrent.Future<Done> whenTerminated()
Scala API: Returns a Future which will be completed after the ActorSystem has been terminated and termination hooks have been executed. TheActorSystem
can be stopped withActorSystem.terminate
or by stopping the guardian actor.- Returns:
- (undocumented)
-
getWhenTerminated
public abstract java.util.concurrent.CompletionStage<Done> getWhenTerminated()
Java API: Returns a CompletionStage which will be completed after the ActorSystem has been terminated and termination hooks have been executed. TheActorSystem
can be stopped withActorSystem.terminate
or by stopping the guardian actor.- Returns:
- (undocumented)
-
deadLetters
public abstract <U> ActorRef<U> deadLetters()
The deadLetter address is a destination that will accept (and discard) every message sent to it.- Returns:
- (undocumented)
-
printTree
public abstract java.lang.String printTree()
Create a string representation of the actor hierarchy within this system for debugging purposes.The format of the string is subject to change, i.e. no stable “API”.
- Returns:
- (undocumented)
-
systemActorOf
public abstract <U> scala.concurrent.Future<ActorRef<U>> systemActorOf(Behavior<U> behavior, java.lang.String name, Props props, Timeout timeout)
Create an actor in the "/system" namespace. This actor will be shut down during system.terminate only after all user actors have terminated.The returned Future of
ActorRef
may be converted into anActorRef
to which messages can immediately be sent by using theActorRef.apply
method.- Parameters:
behavior
- (undocumented)name
- (undocumented)props
- (undocumented)timeout
- (undocumented)- Returns:
- (undocumented)
-
systemActorOf$default$3
public <U> Props systemActorOf$default$3()
-
receptionist
public ActorRef<Receptionist.Command> receptionist()
Return a reference to this system’sReceptionist
.- Returns:
- (undocumented)
-
-