ActorBase Class
- java.
lang. Object - microsoft.
servicefabric. actors. runtime. ActorBase
- microsoft.
public class 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.
Constructor Summary
Constructor | Description | |
---|---|---|
ActorBase(FabricActorService actorService, ActorId actorId) |
Method Summary
Modifier and Type | Method and Description |
---|---|
Fabric |
getActorService()
Gets the stateful service replica that is hosting the actor. |
String |
getApplicationName()
Gets the name of the application that contains the actor service that is hosting this actor. |
DiagnosticsManagerActorContext |
getDiagnosticsContext()
Returns the diagnostics context for an actor. For internal use only. |
<T> T |
getEvent(Class<T> eventClass)
Gets the event for the specified event interface. |
Actor |
getId()
Gets the identity of this actor with the actor service. |
Actor |
getReminder(String reminderName)
Gets the actor reminder with specified reminder name. |
URI |
getServiceUri()
Gets the Uri of the actor service that is hosting this actor. |
boolean |
isDirty()
Check if actor state is dirty. |
CompletableFuture<?> |
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. |
CompletableFuture<?> |
onDeactivateAsync()
Override this method to release any resources including unregistering the timers. This method is called right before the actor is deactivated. |
CompletableFuture<?> |
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:
|
CompletableFuture<?> |
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:
|
CompletableFuture<?> |
registerReminderAsync(String reminderName, byte[] state, Duration dueTime, Duration period)
Registers the specified reminder with actor. |
Actor |
registerTimer(Function<Object, CompletableFuture<?>> asyncCallback, Object state, Duration dueTime, Duration period)
Registers a Timer for the actor. |
Actor |
registerTimer(Function<Object, CompletableFuture<?>> asyncCallback, String asyncCallbackFunctionName, Object state, Duration dueTime, Duration period)
Registers a Timer for the actor. |
void |
setDirty(boolean isDirty)
Sets the actor state as dirty. |
void |
setDummy(boolean isDummy)
Set the actor state whether its dummy or not. |
CompletableFuture<?> |
unregisterReminderAsync(ActorReminder reminder)
Unregisters the specified reminder with actor. |
void |
unregisterTimer(ActorTimer timer)
Unregisters a Timer previously set on this actor. |
Constructor Details
ActorBase
protected ActorBase(FabricActorService actorService, ActorId actorId)
Parameters:
Method Details
getActorService
public FabricActorService getActorService()
Gets the stateful service replica that is hosting the actor.
Returns:
FabricActorService that represents the stateful service replica hosting the actor. actor.
getApplicationName
public String getApplicationName()
Gets the name of the application that contains the actor service that is hosting this actor.
Returns:
getDiagnosticsContext
public DiagnosticsManagerActorContext getDiagnosticsContext()
Returns the diagnostics context for an actor. For internal use only.
Returns:
getEvent
protected
Gets the event for the specified event interface.
Parameters:
Returns:
getId
public ActorId getId()
Gets the identity of this actor with the actor service.
Returns:
ActorId for the actor.
getReminder
protected ActorReminder getReminder(String reminderName)
Gets the actor reminder with specified reminder name.
Parameters:
Returns:
getServiceUri
public URI getServiceUri()
Gets the Uri of the actor service that is hosting this actor.
Returns:
java.net.URI of the actor service that is hosting this actor.
isDirty
public boolean isDirty()
Check if actor state is dirty.
Returns:
onActivateAsync
protected CompletableFuture 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.
Returns:
onDeactivateAsync
protected CompletableFuture onDeactivateAsync()
Override this method to release any resources including unregistering the timers. This method is called right before the actor is deactivated.
Returns:
onPostActorMethodAsync
protected CompletableFuture 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.
Parameters:
Returns:
onPreActorMethodAsync
protected CompletableFuture 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.
Parameters:
Returns:
registerReminderAsync
protected CompletableFuture registerReminderAsync(String reminderName, byte[] state, Duration dueTime, Duration period)
Registers the specified reminder with actor.
Parameters:
Returns:
registerTimer
protected ActorTimer registerTimer(Function
Registers a Timer for the actor.
Parameters:
Returns:
registerTimer
protected ActorTimer registerTimer(Function
Registers a Timer for the actor.
Parameters:
Returns:
setDirty
public void setDirty(boolean isDirty)
Sets the actor state as dirty.
Parameters:
setDummy
protected void setDummy(boolean isDummy)
Set the actor state whether its dummy or not.
Parameters:
unregisterReminderAsync
protected CompletableFuture unregisterReminderAsync(ActorReminder reminder)
Unregisters the specified reminder with actor.
Parameters:
Returns:
unregisterTimer
protected void unregisterTimer(ActorTimer timer)
Unregisters a Timer previously set on this actor.
Parameters:
Applies to
Azure SDK for Java