Package net.sodacan.core.actor
Class AbstractActor
java.lang.Object
net.sodacan.core.actor.AbstractActor
- All Implemented Interfaces:
Actor
- Direct Known Subclasses:
ActorGroupSender
,ActorGroupStats
,JournalWriter
,TimeActor
,WorkerActor
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sodacan.core.Actor
Actor.Builtin
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process one message in the actor which has already been realized, if needed.float
An actor is subject to eviction at any time.void
The default saves the state of the actorMake a map of actorGroup statistics.protected void
handleStage
(Stage stage) Send each message in the stage - we're still in the Actor's run thread.protected Stage
Convenience method to continue processing the next route in the inbound message with no other messages in the stage.Default behavior for an actor is to throw an exceptionvoid
restore()
Restore each of the @Save fields of an actorprotected void
rollback()
Empty the list of staged messages and restore the state of the actor.void
save()
Save state of the save fields of an actor in two steps: Serialize a field content and then persist the resulting serialized byte arrayvoid
If there are any more routes left in the message, the message will be sent to the Host (not directly to target) in case the target ActorGroup has changed to a different Host.void
setActorGroup
(ActorGroup actorGroup) protected void
validateRoute
(Message message, Stage stage)
-
Field Details
-
emptyStage
-
inbound
-
-
Constructor Details
-
AbstractActor
-
-
Method Details
-
evictionProbability
public float evictionProbability()An actor is subject to eviction at any time. However, the lower this value, the less likely is will be chosen for eviction.- Specified by:
evictionProbability
in interfaceActor
- Returns:
-
nextRoute
Convenience method to continue processing the next route in the inbound message with no other messages in the stage.- Returns:
-
callProcessMessage
Process one message in the actor which has already been realized, if needed. This is where we deserialize the jug to a message object.- Specified by:
callProcessMessage
in interfaceActor
-
validateRoute
-
handleStage
Send each message in the stage - we're still in the Actor's run thread.- Parameters:
stage
-
-
send
If there are any more routes left in the message, the message will be sent to the Host (not directly to target) in case the target ActorGroup has changed to a different Host. -
processMessage
Default behavior for an actor is to throw an exception- Specified by:
processMessage
in interfaceActor
- Returns:
- A Stage object containing messages to be processed during Commit
-
getLiveActorGroupStatistics
Make a map of actorGroup statistics. We have to ask the host for this.- Returns:
-
save
public void save()Save state of the save fields of an actor in two steps: Serialize a field content and then persist the resulting serialized byte array -
restore
public void restore()Restore each of the @Save fields of an actor -
exitingThread
public void exitingThread()The default saves the state of the actor- Specified by:
exitingThread
in interfaceActor
-
rollback
protected void rollback()Empty the list of staged messages and restore the state of the actor.
-
getActorId
- Specified by:
getActorId
in interfaceActor
-
getConfig
-
getActorGroup
- Specified by:
getActorGroup
in interfaceActor
-
setActorGroup
- Specified by:
setActorGroup
in interfaceActor
-
getEmptyStage
- Specified by:
getEmptyStage
in interfaceActor
-