ActorBase 类

定义

Represents base class for actors. Actor

Remarks:This is a base type for actor, it provides the functionality that is common across actors implemented by actor deriving from Actor The state is preserved across actor garbage collections and fail-overs. The storage and retrieval of the state is provided by the actor state provider ActorStateProvider.

public class ActorBase
继承
java.lang.Object
ActorBase

构造函数

ActorBase(FabricActorService actorService, ActorId actorId)

方法

getActorService()

Gets the stateful service replica that is hosting the actor.

getApplicationName()

Gets the name of the application that contains the actor service that is hosting this actor.

getDiagnosticsContext()

Returns the diagnostics context for an actor. For internal use only.

getEvent(Class<T> eventClass)

Gets the event for the specified event interface.

getId()

Gets the identity of this actor with the actor service.

getReminder(String reminderName)

Gets the actor reminder with specified reminder name.

getServiceUri()

Gets the Uri of the actor service that is hosting this actor.

isDirty()

Check if actor state is dirty.

onActivateAsync()

Override this method to initialize the members, initialize state or register timers. This method is called right after the actor is activated and before any method call or reminders are dispatched on it.

onDeactivateAsync()

Override this method to release any resources including unregistering the timers. This method is called right before the actor is deactivated.

onPostActorMethodAsync(ActorMethodContext actorMethodContext)

This method is invoked by actor runtime an actor method has finished execution. Override this method for performing any actions after an actor method has finished execution.

Remarks: This method is invoked by actor runtime prior to:

  • Invoking an actor interface method when a client request comes.

  • Invoking a method on Remindable interface when a reminder fires.

  • Invoking a timer callback when timer fires.

onPreActorMethodAsync(ActorMethodContext actorMethodContext)

This method is invoked by actor runtime just before invoking an actor method. Override this method for performing any actions prior to an actor method is invoked.

Remarks:This method is invoked by actor runtime prior to:

  • Invoking an actor interface method when a client request comes.

  • Invoking a method on Remindable interface when a reminder fires.

  • Invoking a timer callback when timer fires.

registerReminderAsync(String reminderName, byte[] state, Duration dueTime, Duration period)

Registers the specified reminder with actor.

registerTimer(Function<Object, CompletableFuture<?>> asyncCallback, Object state, Duration dueTime, Duration period)

Registers a Timer for the actor.

registerTimer(Function<Object, CompletableFuture<?>> asyncCallback, String asyncCallbackFunctionName, Object state, Duration dueTime, Duration period)

Registers a Timer for the actor.

setDirty(boolean isDirty)

Sets the actor state as dirty.

setDummy(boolean isDummy)

Set the actor state whether its dummy or not.

unregisterReminderAsync(ActorReminder reminder)

Unregisters the specified reminder with actor.

unregisterTimer(ActorTimer timer)

Unregisters a Timer previously set on this actor.

适用于