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 TypeMethodDescriptionvoidProcess one message in the actor which has already been realized, if needed.floatAn actor is subject to eviction at any time.voidThe default saves the state of the actorMake a map of actorGroup statistics.protected voidhandleStage(Stage stage) Send each message in the stage - we're still in the Actor's run thread.protected StageConvenience 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 exceptionvoidrestore()Restore each of the @Save fields of an actorprotected voidrollback()Empty the list of staged messages and restore the state of the actor.voidsave()Save state of the save fields of an actor in two steps: Serialize a field content and then persist the resulting serialized byte arrayvoidIf 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.voidsetActorGroup(ActorGroup actorGroup) protected voidvalidateRoute(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:
evictionProbabilityin 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:
callProcessMessagein 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:
processMessagein 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:
exitingThreadin interfaceActor
-
rollback
protected void rollback()Empty the list of staged messages and restore the state of the actor.
-
getActorId
- Specified by:
getActorIdin interfaceActor
-
getConfig
-
getActorGroup
- Specified by:
getActorGroupin interfaceActor
-
setActorGroup
- Specified by:
setActorGroupin interfaceActor
-
getEmptyStage
- Specified by:
getEmptyStagein interfaceActor
-