Class IIActorSystem

java.lang.Object
com.scivicslab.pojoactor.core.ActorSystem
com.scivicslab.pojoactor.workflow.IIActorSystem
Direct Known Subclasses:
DistributedActorSystem

public class IIActorSystem extends ActorSystem
Interpreter-interfaced actor system for managing workflow actors.

In order to use ActorRef from an interpreter, it must have an interface that can call methods by their name strings. The IIActorRef class exists for this purpose.

This IIActorSystem is a subclass of ActorSystem with the function of managing IIActorRef. The IIActorSystem can manage ordinary ActorRefs as well as the IIActorRefs, so the two can be used intermixed in a program.

The following methods have been added to manage IIActorRef objects:

  • addIIActor
  • getIIActor
  • hasIIActor
  • removeIIActor
  • terminateIIActors
Author:
devteam@scivics-lab.com
  • Constructor Details

    • IIActorSystem

      public IIActorSystem(String systemName)
      Constructs a new IIActorSystem with the specified system name.
      Parameters:
      systemName - the name of this actor system
    • IIActorSystem

      public IIActorSystem(String systemName, int threadNum)
      Constructs a new IIActorSystem with the specified system name and thread count.
      Parameters:
      systemName - the name of this actor system
      threadNum - the number of threads in the worker pool
  • Method Details

    • addIIActor

      public <T> IIActorRef<T> addIIActor(IIActorRef<T> actor)
      Adds an interpreter-interfaced actor to this system.
      Type Parameters:
      T - the type of the actor object
      Parameters:
      actor - the actor reference to add
      Returns:
      the added actor reference
    • getIIActor

      public <T> IIActorRef<T> getIIActor(String name)
      Retrieves an interpreter-interfaced actor by name.
      Type Parameters:
      T - the type of the actor object
      Parameters:
      name - the name of the actor to retrieve
      Returns:
      the actor reference, or null if not found
    • hasIIActor

      public boolean hasIIActor(String name)
      Checks if an interpreter-interfaced actor with the given name exists.
      Parameters:
      name - the name of the actor to check
      Returns:
      true if the actor exists, false otherwise
    • removeIIActor

      public void removeIIActor(String name)
      Removes an interpreter-interfaced actor from this system.
      Parameters:
      name - the name of the actor to remove
    • getIIActorCount

      public int getIIActorCount()
      Returns the number of interpreter-interfaced actors in this system.
      Returns:
      the count of IIActorRef instances
    • listActorNames

      public List<String> listActorNames()
      Returns the names of all interpreter-interfaced actors in this system.

      This method overrides the base class method to return IIActorRef names instead of regular ActorRef names.

      Overrides:
      listActorNames in class ActorSystem
      Returns:
      a list of actor names
      Since:
      2.9.0
    • terminateIIActors

      public void terminateIIActors()
      Terminates all interpreter-interfaced actors managed by this system.

      This method closes all registered IIActorRef instances, releasing their associated resources.

    • resolveActorPath

      public List<IIActorRef<?>> resolveActorPath(String fromActorName, String actorPath)
      Resolves an actor path relative to a given actor using Unix-style path notation.

      Supports the following path formats:

      • . or this - self (the actor specified by fromActorName)
      • .. - parent actor
      • ./* - all children of self
      • ../* - all siblings (all children of parent)
      • ../sibling - specific sibling by name
      • ../web* - siblings whose names start with "web"
      • ../*server - siblings whose names end with "server"
      • ./child* - children whose names start with "child"

      Wildcard patterns:

      • * - matches all actors in the scope
      • prefix* - matches actors whose names start with "prefix"
      • *suffix - matches actors whose names end with "suffix"
      • *middle* - matches actors whose names contain "middle"
      Parameters:
      fromActorName - the name of the actor from which the path is relative
      actorPath - Unix-style path (e.g., ".", "this", "..", "../sibling", "../web*")
      Returns:
      list of matching actors (empty list if no matches found)
      Throws:
      IllegalArgumentException - if fromActorName does not exist or path is invalid
      Since:
      2.6.0