public abstract class Actor extends Object implements Startable, Stoppable, Relocatable, TestStateView
Actor types. This base provides common
facilities and life cycle processing for all Actor types.| Modifier | Constructor and Description |
|---|---|
protected |
Actor()
Initializes the newly created
Actor. |
| Modifier and Type | Method and Description |
|---|---|
Address |
address()
Answers the
address of this Actor. |
protected void |
afterRestart(Throwable reason)
The message delivered after the
Actor has been restarted by its supervisor due to an exception. |
protected void |
afterStop()
The message delivered after the
Actor has fully stopped. |
protected <R> io.vlingo.xoom.common.Completes<R> |
answerFrom(io.vlingo.xoom.common.Completes<R> eventualOutcome)
Answer my internal
Completes<R> from completes() after preparing
for the eventualOutcome to be set in my completesEventually(). |
protected void |
beforeRestart(Throwable reason)
The message delivered before the
Actor has been restarted by its supervisor due to an exception. |
protected void |
beforeResume(Throwable reason)
The message delivered before the
Actor has been resumed by its supervisor due to an exception. |
protected void |
beforeStart()
The message delivered before the
Actor has fully started. |
protected Protocols |
childActorFor(Class<?>[] protocols,
Definition definition)
Answers the
Protocols for the child Actor to be created by this parent Actor. |
protected <T> T |
childActorFor(Class<T> protocol,
Definition definition)
Answers the
T protocol for the child Actor to be created by this parent Actor. |
protected <T> CompletableFuture<T> |
completableFuture()
Answers the
CompletableFuture<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a CompletableFuture<T>. |
protected <T> io.vlingo.xoom.common.Completes<T> |
completes()
Answers the
Completes<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a Completes<T>. |
protected CompletesEventually |
completesEventually()
Answers a
CompletesEventually if the behavior of the currently
delivered Message does answers a Completes<T>. |
void |
conclude()
Concludes the receiver, eventually causing
it to receive a stop() message.
|
DeadLetters |
deadLetters()
Answers the
DeadLetters for this Actor. |
Definition |
definition()
Answers the
Definition of this Actor. |
protected void |
disperseStowedMessages()
Starts the process of dispersing any messages stowed for this
Actor. |
boolean |
equals(Object other)
Answers whether or not this
Actor is equal to other. |
protected <T> Future<T> |
future(Callable<T> callable)
Answers the
Future<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a Future<T>. |
int |
hashCode()
Answers the
int hash code of this Actor. |
boolean |
isStopped()
Answers whether or not this
Actor has been stopped or is in the process or stopping. |
protected Logger |
logger()
Answers the
Logger of this Actor. |
protected <T> T |
parentAs(Class<T> protocol)
Answers the parent of this
Actor as the T protocol. |
io.vlingo.xoom.common.Scheduler |
scheduler()
Answers the
Scheduler for this Actor. |
protected void |
secure()
Secures this
Actor. |
protected <T> T |
selfAs(Class<T> protocol)
Answers this
Actor as a T protocol. |
protected Stage |
stage()
Answers the
Stage of this Actor. |
protected Stage |
stageNamed(String name)
Answers the
Stage of the given name. |
void |
start()
The default implementation of
start(), which is a no-op. |
<S> S |
stateSnapshot()
Answer my
S typed state snapshot, which is null by default. |
<S> void |
stateSnapshot(S stateSnapshot)
Sets my
S typed state snapshot, which by default does nothing. |
void |
stop()
Initiates the process of stopping this
Actor and all of its children. |
protected void |
stowMessages(Class<?>... stowageOverrides)
Starts the process of stowing messages for this
Actor, and registers stowageOverrides as
the protocol that will trigger dispersal. |
String |
toString()
Answers the
String representation of this Actor. |
TestState |
viewTestState()
Answers the
TestState for this Actor. |
void |
viewTestStateInitialization(TestContext context)
Received from the surrounding
testkit.TestActor to indicate
that it is in use, enabling any special test initialization as
needed. |
public Address address()
address of this Actor.public void conclude()
Stoppableconclude in interface StoppableStoppable.conclude()public DeadLetters deadLetters()
DeadLetters for this Actor.public io.vlingo.xoom.common.Scheduler scheduler()
Scheduler for this Actor.public <S> void stateSnapshot(S stateSnapshot)
RelocatableS typed state snapshot, which by default does nothing.
Override to set a snapshot state.stateSnapshot in interface RelocatableS - the type of the state snapshotstateSnapshot - the S typed state snapshot to setRelocatable.stateSnapshot(java.lang.Object)public <S> S stateSnapshot()
RelocatableS typed state snapshot, which is null by default.
Override to provide a snapshot state.stateSnapshot in interface RelocatableS - the type of my snapshot stateRelocatable.stateSnapshot()public void start()
start(), which is a no-op. Override if needed.start in interface StartableStartable.start()public boolean isStopped()
Actor has been stopped or is in the process or stopping.isStopped in interface StoppableStoppable.isStopped()public void stop()
Actor and all of its children.stop in interface StoppableStoppable.stop()public void viewTestStateInitialization(TestContext context)
testkit.TestActor to indicate
that it is in use, enabling any special test initialization as
needed. This is received (1) with a TestContext when the
TestActor is first constructed, and (2) with null
before each TestMailbox delivery.context - the TestContextpublic TestState viewTestState()
TestState for this Actor. Override to provide a snapshot of the current Actor state.viewTestState in interface TestStateViewpublic boolean equals(Object other)
Actor is equal to other.public int hashCode()
int hash code of this Actor.public String toString()
String representation of this Actor.protected <R> io.vlingo.xoom.common.Completes<R> answerFrom(io.vlingo.xoom.common.Completes<R> eventualOutcome)
Completes<R> from completes() after preparing
for the eventualOutcome to be set in my completesEventually().R - the type of eventual outcomeeventualOutcome - the Completes<R> the provides an eventual outcomeCompletes<R>protected <T> T childActorFor(Class<T> protocol, Definition definition)
T protocol for the child Actor to be created by this parent Actor.T - the protocol typeprotocol - the Class<T> protocol of the child Actordefinition - the Definition of the child Actor to be created by this parent Actorprotected Protocols childActorFor(Class<?>[] protocols, Definition definition)
Protocols for the child Actor to be created by this parent Actor.protocols - the Class<T>[] protocols of the child Actordefinition - the Definition of the child Actor to be created by this parent Actorprotected <T> io.vlingo.xoom.common.Completes<T> completes()
Completes<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a Completes<T>.T - the protocol typeCompletes<T>protected <T> CompletableFuture<T> completableFuture()
CompletableFuture<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a CompletableFuture<T>.T - the protocol typeCompletableFuture<T>protected <T> Future<T> future(Callable<T> callable)
Future<T> instance for this Actor, or throws IllegalStateException if the behavior of the currently
delivered Message does not answer a Future<T>.T - the protocol typecallable - the Callable<T> producing the outcome for the Future<T> to answerFuture<T>protected CompletesEventually completesEventually()
CompletesEventually if the behavior of the currently
delivered Message does answers a Completes<T>. Otherwise the outcome
is undefined.public Definition definition()
Definition of this Actor.protected Logger logger()
Logger of this Actor.protected <T> T parentAs(Class<T> protocol)
Actor as the T protocol.T - the protocol typeprotocol - the Class<T> of the protocolprotected void secure()
Actor. (INTERNAL ONLY)protected <T> T selfAs(Class<T> protocol)
Actor as a T protocol. This Actor must implement the Class<T> protocol.T - the protocol typeprotocol - the Class<T> protocolprotected final Stage stage()
Stage of this Actor.protected Stage stageNamed(String name)
Stage of the given name.name - the String name of the Stage to findprotected void disperseStowedMessages()
Actor.protected void stowMessages(Class<?>... stowageOverrides)
Actor, and registers stowageOverrides as
the protocol that will trigger dispersal.stowageOverrides - the Class<T> protocol that will trigger dispersalprotected void beforeStart()
Actor has fully started. Override to implement.protected void afterStop()
Actor has fully stopped. Override to implement.protected void beforeRestart(Throwable reason)
Actor has been restarted by its supervisor due to an exception.
Override to implement.reason - the Throwable cause of the supervision restartprotected void afterRestart(Throwable reason)
Actor has been restarted by its supervisor due to an exception.
Override to implement.reason - the Throwable cause of the supervision restartprotected void beforeResume(Throwable reason)
Actor has been resumed by its supervisor due to an exception.
Override to implement.reason - the Throwable cause of the supervision resumeCopyright © 2021. All rights reserved.