Class SchedulerIIAR
java.lang.Object
com.scivicslab.pojoactor.core.ActorRef<Scheduler>
com.scivicslab.pojoactor.workflow.IIActorRef<Scheduler>
com.scivicslab.pojoactor.workflow.scheduler.SchedulerIIAR
- All Implemented Interfaces:
CallableByActionName,AutoCloseable
Interpreter-interfaced actor reference for
Scheduler instances.
This class provides a concrete implementation of IIActorRef
specifically for Scheduler objects. It delegates action invocations
directly to the scheduler's Scheduler.callByActionName(String, String) method.
Usage Example:
IIActorSystem system = new IIActorSystem("my-system");
// Create scheduler
Scheduler scheduler = new Scheduler(system);
SchedulerIIAR schedulerRef = new SchedulerIIAR("scheduler", scheduler, system);
system.addIIActor(schedulerRef);
// Schedule a periodic task
schedulerRef.callByActionName("scheduleAtFixedRate",
"healthcheck,server,check,,0,10,SECONDS");
// Cancel a task
schedulerRef.callByActionName("cancel", "healthcheck");
- Since:
- 2.5.0
- Author:
- devteam@scivics-lab.com
- See Also:
-
Field Summary
Fields inherited from class com.scivicslab.pojoactor.core.ActorRef
actorName, actorSystem, object -
Constructor Summary
ConstructorsConstructorDescriptionSchedulerIIAR(String actorName, Scheduler object) Constructs a new SchedulerIIAR with the specified actor name and scheduler object.SchedulerIIAR(String actorName, Scheduler object, IIActorSystem system) Constructs a new SchedulerIIAR with the specified actor name, scheduler object, and actor system. -
Method Summary
Modifier and TypeMethodDescriptioncallByActionName(String actionName, String arg) Invokes an action on the scheduler by name with the given arguments.Methods inherited from class com.scivicslab.pojoactor.core.ActorRef
ask, ask, askNow, clearJsonState, clearPendingMessages, close, createChild, getJsonBoolean, getJsonInt, getJsonString, getJsonString, getName, getNamesOfChildren, getParentName, hasJson, hasJsonState, initLogger, isAlive, json, putJson, setParentName, system, tell, tell, tellNow
-
Constructor Details
-
SchedulerIIAR
Constructs a new SchedulerIIAR with the specified actor name and scheduler object.- Parameters:
actorName- the name of this actorobject- theSchedulerinstance managed by this actor reference
-
SchedulerIIAR
Constructs a new SchedulerIIAR with the specified actor name, scheduler object, and actor system.- Parameters:
actorName- the name of this actorobject- theSchedulerinstance managed by this actor referencesystem- the actor system managing this actor
-
-
Method Details
-
callByActionName
Invokes an action on the scheduler by name with the given arguments.This method delegates to the scheduler's
Scheduler.callByActionName(String, String)method.Supported actions:
scheduleAtFixedRate- Schedule a task at fixed rate
Args: taskId,targetActor,action,args,initialDelay,period,unitscheduleWithFixedDelay- Schedule a task with fixed delay
Args: taskId,targetActor,action,args,initialDelay,delay,unitscheduleOnce- Schedule a one-time task
Args: taskId,targetActor,action,args,delay,unitcancel- Cancel a scheduled task
Args: taskIdgetTaskCount- Get number of scheduled tasks
Args: (none)isScheduled- Check if a task is scheduled
Args: taskId
- Specified by:
callByActionNamein interfaceCallableByActionName- Specified by:
callByActionNamein classIIActorRef<Scheduler>- Parameters:
actionName- the name of the action to executearg- the argument string (format depends on the action)- Returns:
- an
ActionResultindicating success or failure with a message
-