Package net.sodacan.core
Interface Actor
- All Known Implementing Classes:
AbstractActor
,ActorGroupSender
,ActorGroupStats
,JournalWriter
,Sleeper
,TimeActor
,WorkerActor
public interface Actor
- An actor has a unique and permanent Id.
- An actor is persistent.
- An actor is permanently assigned to an actorGroup
The flow is straightforward: When the ActorGroup scheduler receives a message destined for a particular Actor If that Actor is currently not in memory, it is constructed, any state is restored, and the scheduler starts the Actor running.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
float
The higher an eviction rate, the higher chance of eviction.void
The default saves the state of the actor.Process one message.void
restore()
void
save()
void
Send a message immediately rather than in the Stage.void
setActorGroup
(ActorGroup actorGroup)
-
Method Details
-
processMessage
Stage processMessage()Process one message.
The actor can assume that no other inbound messages or method calls will occur during processing. The actor will be running in a dedicated thread.
The result of this one process is a Stage which encapsulates all external effects (messages) resulting from the inbound message, if any.
The inbound message is available in the superclass as the field inbound.
- Returns:
- A Stage object containing messages to be processed during Commit
-
send
Send a message immediately rather than in the Stage. This message cannot be rolled back.- Parameters:
message
-
-
restore
void restore() -
save
void save() -
exitingThread
void exitingThread()The default saves the state of the actor. -
callProcessMessage
-
getActorId
ActorId getActorId() -
getConfig
Config getConfig() -
getActorGroup
ActorGroup getActorGroup() -
setActorGroup
-
evictionProbability
float evictionProbability()The higher an eviction rate, the higher chance of eviction. This number can change dynamically with circumstances. This value does not assure eviction (1.0) or retention (0.0).- Returns:
-
getEmptyStage
Stage getEmptyStage()
-