Class SchedulerIIAR

All Implemented Interfaces:
CallableByActionName, AutoCloseable

public class SchedulerIIAR extends IIActorRef<Scheduler>
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:
  • Constructor Details

    • SchedulerIIAR

      public SchedulerIIAR(String actorName, Scheduler object)
      Constructs a new SchedulerIIAR with the specified actor name and scheduler object.
      Parameters:
      actorName - the name of this actor
      object - the Scheduler instance managed by this actor reference
    • SchedulerIIAR

      public SchedulerIIAR(String actorName, Scheduler object, IIActorSystem system)
      Constructs a new SchedulerIIAR with the specified actor name, scheduler object, and actor system.
      Parameters:
      actorName - the name of this actor
      object - the Scheduler instance managed by this actor reference
      system - the actor system managing this actor
  • Method Details

    • callByActionName

      public ActionResult callByActionName(String actionName, String arg)
      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,unit
      • scheduleWithFixedDelay - Schedule a task with fixed delay
        Args: taskId,targetActor,action,args,initialDelay,delay,unit
      • scheduleOnce - Schedule a one-time task
        Args: taskId,targetActor,action,args,delay,unit
      • cancel - Cancel a scheduled task
        Args: taskId
      • getTaskCount - Get number of scheduled tasks
        Args: (none)
      • isScheduled - Check if a task is scheduled
        Args: taskId
      Specified by:
      callByActionName in interface CallableByActionName
      Specified by:
      callByActionName in class IIActorRef<Scheduler>
      Parameters:
      actionName - the name of the action to execute
      arg - the argument string (format depends on the action)
      Returns:
      an ActionResult indicating success or failure with a message