-
Notifications
You must be signed in to change notification settings - Fork 0
Actor Supervision Module
github-actions[bot] edited this page Jun 27, 2026
·
1 revision
The io.github.solaceharmony.core.actor.supervisor package provides a mechanism for managing groups of actors.
This class is a concrete implementation of Actor designed to oversee and manage a collection of other "child" or "managed" actors. Its focus is on dynamic registration, lifecycle control, and hot-swapping of these actors.
- Purpose: To act as a central point for managing a group of actors, allowing for their addition, removal, and replacement at runtime, as well as collective lifecycle operations.
-
Inheritance: Extends
io.github.solaceharmony.core.actor.Actor. -
Key Responsibilities and Features:
-
Actor Registry:
- Maintains an internal registry (
actorRegistry: Map<String, Actor>) of actors it manages, keyed by actor ID. - Also keeps track of the
KClassof each registered actor (actorTypeRegistry) for type-safe operations like hot-swapping. - Access to these registries is synchronized using a
Mutex.
- Maintains an internal registry (
-
Dynamic Actor Management:
-
suspend fun registerActor(actor: Actor): Boolean: Adds a new actor to its management pool. Requires theSupervisorActorto be running. -
suspend fun unregisterActor(actorId: String): Boolean: Removes an actor from its management pool. Requires theSupervisorActorto be running. -
suspend fun hotSwapActor(oldActorId: String, newActor: Actor): Boolean: Replaces an existing managed actor with a new instance. The process, as detailed in the wiki SupervisorActor page, involves:- Checking if the
oldActorIdexists in the registry. - Verifying that the
newActoris of the sameKClassas the old one, ensuring type safety. - Noting if the old actor was in a
Runningstate. - Stopping the old actor.
- Replacing the old actor with the new one in the internal
actorRegistryandactorTypeRegistry. - Starting the
newActorif the old actor was previously running. This operation requires theSupervisorActoritself to be in aRunningstate.
- Checking if the
-
-
Actor Registry:
-
Operational Note: Most dynamic management operations (
registerActor,unregisterActor,hotSwapActor) and collective lifecycle controls (startAllActors,stopAllActors) require theSupervisorActorto be in aRunningstate. Attempting these operations when the supervisor is not running will typically result in anIllegalStateException. Furthermore, methods likeregisterActor,unregisterActor, andhotSwapActorreturn aBooleanvalue:trueindicates successful completion, whilefalseusually signifies a failure due to conditions such as a non-existent actor ID or a type mismatch during hot-swapping, as noted in the wiki SupervisorActor page.-
Actor Discovery:
-
suspend fun getActor(actorId: String): Actor?: Retrieves a specific managed actor by its ID. -
suspend fun getAllActors(): List<Actor>: Returns a list of all actors currently managed by the supervisor. -
suspend fun getActorsByType(actorType: KClass<out Actor>): List<Actor>: Retrieves all managed actors that are instances of a specificactorType.
-
-
Collective Lifecycle Control:
-
suspend fun startAllActors(): Callsstart()on all managed actors. Requires theSupervisorActorto be running. -
suspend fun stopAllActors(): Callsstop()on all managed actors. Requires theSupervisorActorto be running.
-
-
Resource Cleanup (
dispose()):- When the
SupervisorActoritself is disposed, it iterates through all its managed actors inactorRegistryand callsdispose()on each, then clears its internal registries before callingsuper.dispose().
- When the
-
Actor Discovery:
The wiki SupervisorActor page outlines several best practices for using the SupervisorActor effectively:
-
Initialization Order: Always start the
SupervisorActor(by calling itsstart()method) before attempting to register any child actors. - Unique Actor IDs: Ensure that all actors registered with a supervisor have unique IDs to prevent registration conflicts and ensure predictable behavior.
-
Hot-Swap Compatibility: When hot-swapping actors, verify that the new actor instance is not only of the same
KClassbut also logically compatible with the role and connections of the actor it is replacing. -
Resource Management: Dispose of the
SupervisorActorusing itsdispose()method when it is no longer needed. This ensures that all managed actors are also properly disposed of, releasing their resources. -
Fault Tolerance:
- The
SupervisorActoras defined in this file primarily focuses on lifecycle management and dynamic updates rather than implementing traditional actor supervision strategies (e.g., "one-for-one," "all-for-one" restart/stop strategies upon child failure). Fault handling for individual actors would typically be the responsibility of the actors themselves or a different supervisory layer if more complex strategies are needed.
- The
SolaceCore SSOT wiki · published from wiki/ by .github/workflows/publish-wiki.yml · edit the source in the repo, not the wiki.
Orientation
- Architectural Deep Dive
- Architecture Overview
- Design vs Implementation
- Framework Actor System
- Framework Architectural Vision
- Framework Concurrency and Communication
- Framework Data Storage and Management
- Framework Deployment and Containerization
- Framework Development Roadmap
- Framework Hot-Pluggable System
- Framework Implementation Status
- Framework Observability and Monitoring
- Framework Port System
- Framework System Architecture
- Framework Workflow Management
- Project Status
- Project Status Report
- Quick Status
- Solace Core Framework Architecture
- SolaceCore Architecture Overview
- Vision & Solace AI
Runtime
- Actor Builder
- Actor Communication Sequence Diagram
- Actor Core Definitions
- Actor Graph View
- Actor Metrics
- Actor Module Architecture
- Actor Queue Hibernation and Correlation
- Actor Roadmap
- Actor State Recovery Subsystem
- Actor State Serialization Subsystem
- Actor Supervision Module
- Actor System Architecture
- Actor System Class Diagram
- Actor Usage Examples
- Compose App Features
- JVM Scripting Implementations
- Kernel & Ports
- Kernel Channel System
- Kernel Future Enhancements
- Kernel Module Architecture
- Kernel Port Implementations and Exceptions
- Kernel Port Usage Example
- Kernel Testing Strategy
- Lifecycle Class Diagram
- Lifecycle Management Architecture
- Pipeline DSL
- Real-Time UI Implementation
- Scripting Module Architecture
- Scripting Module Design
- Scripting Supporting Components
- Shared Memory
- Storage & Persistence
- Storage Abstractions Architecture
- Storage Caching Subsystem
- Storage Checklist
- Storage Compression Subsystem
- Storage Core Interfaces
- Storage Encryption Subsystem
- Storage File-Based Architecture
- Storage File-Based Implementations
- Storage In-Memory Architecture
- Storage In-Memory Implementations
- Storage JVM Serialization Utilities
- Storage Module Architecture
- Storage Serialization Compression Encryption
- Storage Specialized Interfaces Architecture
- Storage Status and Future Plans
- Storage Testing
- Storage Thread Safety Guide
- Storage Thread Safety and Deadlock Prevention
- Storage Transactions
- Storage Usage Examples
- Supervisor and Hot Swap
- SupervisorActor
- System Architecture Diagram
- Workflow Management Architecture
- Workflow Management Design Concept
- Workflow Orchestration
Solace AI
- Confusion Corrector
- Inference Cube
- Inference Cube Technical Architecture
- Long-Term Memory
- MCP and Tool Format
- Memory & Reflection
- Memory Compression
- Memory Feature Overview
- Memory Retrieval
- Mood & Emotional Model
- Mood Module Implementation
- Mouth Tool Technical Spec
- Multimodal Nudging
- Perception Actors
- Provider Specs
- Reflection Memory
- Solace AI Overview
- Supervisor AI
- Supervisor Emotional Model Integration
- Time Actor
- Voice & Mouth Tool
- Working Memory
- Zoom Level Technical Spec
- Zoom Levels
Reference
- Advanced Workflow Example
- Basic Actor Usage
- Build System and Dependencies
- Development Tooling and Practices
- Documentation Catalog
- Documentation Index
- Feature Index
- Glossary
- How the Wiki Publishes
- JVM Utilities
- Kotlin Implementation Details
- Kotlin-Aligned Architecture Overview
- Kotlin-Aligned Contributing
- Kotlin-Aligned Core Architectural Principles
- Kotlin-Aligned Daily Development Workflow
- Kotlin-Aligned Development Examples
- Kotlin-Aligned Development Workflow
- Kotlin-Aligned Documentation
- Kotlin-Aligned Implementation Status
- Kotlin-Aligned Key Concepts
- Kotlin-Aligned Known Issues
- Kotlin-Aligned Quick Start
- Kotlin-Aligned Running the System
- Kotlin-Aligned System Architecture
- LangChain Actor Code Changes
- LangChain Actor Usage Improvements
- LangChain ActorInterface Code Changes
- LangChain Best Practices
- LangChain Bugs
- LangChain Chain Implementation
- LangChain Code Changes
- LangChain Code Changes Rollout and Impact
- LangChain Configuration Management Improvements
- LangChain Configuration Recommendations
- LangChain Core Architecture Recommendations
- LangChain Directory Structure Changes
- LangChain Documentation Improvements
- LangChain Dynamic Wiring Rollout Notes
- LangChain Fix Proposal
- LangChain Implementation Priorities
- LangChain Lifecycle Management Improvements
- LangChain Memory Integration Recommendations
- LangChain Metrics and Observability Recommendations
- LangChain Migration Strategy
- LangChain New Files Needed
- LangChain New Packages to Add
- LangChain Package-by-Package Improvements
- LangChain Patterns
- LangChain Port Code Changes
- LangChain Port System Recommendations
- LangChain Port Usability Improvements
- LangChain Prompt Management Recommendations
- LangChain Recommendations
- LangChain Recommendations Rollout Plan
- LangChain Required Interface Changes
- LangChain Testing Changes
- LangChain Testing Improvements
- LangChain Testing Recommendations
- LangChain Tool Integration Recommendations
- LangChain Type-Safe Dynamic Wiring
- LangChain Type-Safe Dynamic Wiring System
- LangChain Usage Design Improvements
- Master Checklist
- Roadmap
- Roadmap Issues
- Roadmap Phase 1 Stability and Testing
- Roadmap Phase 2 Production Infrastructure
- Roadmap Phase 3 Documentation and Developer Experience
- Roadmap Phase 4 Graph Database Integration
- Roadmap Phase 5 Security Framework
- Roadmap Phase 6 Distributed System
- Roadmap Phase 7 Advanced Features
- Roadmap Phase 8 Ecosystem Development
- Roadmap Timeline and Success Metrics
- Setup Instructions
- Sketch Architecture
- Status Documentation
- Task 1 Core Tests
- Task 2 Connection Wiring
- Task 3 Concurrency Issues
- Task 4 Dynamic Registration
- Task 5 Integration Tests
- Task 6 Deadlock Detection
- Task Documentation
- Test Coverage Checklist
- Testing Strategy