Class IIActorSystem
java.lang.Object
com.scivicslab.pojoactor.core.ActorSystem
com.scivicslab.pojoactor.workflow.IIActorSystem
- Direct Known Subclasses:
DistributedActorSystem
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.scivicslab.pojoactor.core.ActorSystem
ActorSystem.Builder -
Field Summary
Fields inherited from class com.scivicslab.pojoactor.core.ActorSystem
actors, systemName, workerPools -
Constructor Summary
ConstructorsConstructorDescriptionIIActorSystem(String systemName) Constructs a new IIActorSystem with the specified system name.IIActorSystem(String systemName, int threadNum) Constructs a new IIActorSystem with the specified system name and thread count. -
Method Summary
Modifier and TypeMethodDescription<T> IIActorRef<T> addIIActor(IIActorRef<T> actor) Adds an interpreter-interfaced actor to this system.<T> IIActorRef<T> getIIActor(String name) Retrieves an interpreter-interfaced actor by name.intReturns the number of interpreter-interfaced actors in this system.booleanhasIIActor(String name) Checks if an interpreter-interfaced actor with the given name exists.Returns the names of all interpreter-interfaced actors in this system.voidremoveIIActor(String name) Removes an interpreter-interfaced actor from this system.List<IIActorRef<?>> resolveActorPath(String fromActorName, String actorPath) Resolves an actor path relative to a given actor using Unix-style path notation.voidTerminates all interpreter-interfaced actors managed by this system.Methods inherited from class com.scivicslab.pojoactor.core.ActorSystem
actorOf, addActor, addActor, addActor, addWorkStealingPool, getActor, getLogger, getWorkStealingPool, getWorkStealingPool, hasActor, initLogger, isAlive, isAlive, removeActor, root, setLogger, terminate, toString
-
Constructor Details
-
IIActorSystem
Constructs a new IIActorSystem with the specified system name.- Parameters:
systemName- the name of this actor system
-
IIActorSystem
Constructs a new IIActorSystem with the specified system name and thread count.- Parameters:
systemName- the name of this actor systemthreadNum- the number of threads in the worker pool
-
-
Method Details
-
addIIActor
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
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
nullif not found
-
hasIIActor
Checks if an interpreter-interfaced actor with the given name exists.- Parameters:
name- the name of the actor to check- Returns:
trueif the actor exists,falseotherwise
-
removeIIActor
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
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:
listActorNamesin classActorSystem- 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
Resolves an actor path relative to a given actor using Unix-style path notation.Supports the following path formats:
.orthis- 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 scopeprefix*- 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 relativeactorPath- 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
-