HouseManager

cc.otavia.core.system.HouseManager
See theHouseManager companion object
final class HouseManager(val thread: ActorThread)

Per-ActorThread scheduler that manages three priority queues for actor house scheduling.

Queue assignment is based on actor type:

  • '''mountingQueue''' (FIFO): houses awaiting initial mount (all types)
  • '''channelsActorQueue''' (Priority): IO-capable actor, fully drained in Phase 2 with no time budget
  • '''actorQueue''' (Priority): business logic actor, time-budgeted in Phase 3

Each PriorityHouseQueue has two sub-queues: normal priority and high priority. Houses are classified as high priority based on three signals (see ActorHouse._highPriority): reply backlog, event backlog, and no downstream blocking (no pending promises). Priority is determined at enqueue time; there is no mid-queue promotion.

Value parameters

thread

the owning ActorThread

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def hasOtherReady(house: ActorHouse): Boolean

Whether the scheduling queue for the given actor type has other houses waiting. Used by the dispatch-loop optimization to decide whether the current actor can re-enter dispatch without re-queueing.

Whether the scheduling queue for the given actor type has other houses waiting. Used by the dispatch-loop optimization to decide whether the current actor can re-enter dispatch without re-queueing.

Attributes

def laterTasks: ArrayDeque[Runnable]
def mount(house: ActorHouse): Unit

Schedule a newly created house for mounting.

Schedule a newly created house for mounting.

Attributes

def ready(house: ActorHouse): Unit

Enqueue an ActorHouse that has transitioned from WAITING to READY. The house is placed into the appropriate queue based on its actor type:

Enqueue an ActorHouse that has transitioned from WAITING to READY. The house is placed into the appropriate queue based on its actor type:

Attributes

def runChannelsActors(): Unit

Run channels actor queue (IO pipeline work) and mounting queue. These are always drained fully as they are part of the IO pipeline and must not be starved.

Run channels actor queue (IO pipeline work) and mounting queue. These are always drained fully as they are part of the IO pipeline and must not be starved.

Attributes

def runStateActors(deadlineNanos: Long): Unit

Run state actor queue (business logic) within the given time budget. Actors that are not processed within the deadline remain in the queue for the next iteration.

Run state actor queue (business logic) within the given time budget. Actors that are not processed within the deadline remain in the queue for the next iteration.

Value parameters

deadlineNanos

the absolute time (in nanos) after which no more actor should be dequeued. Long.MaxValue means no limit.

Attributes

def runnable: Boolean

Whether any queue has work available. Used by the IO handler to determine if it can block on select.

Whether any queue has work available. Used by the IO handler to determine if it can block on select.

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def trySteal(): Boolean

Attempt to steal a StateActor from another ActorThread's queue. Used as a safety net for extreme load imbalance — the primary scheduling model keeps actors on their owning thread for CPU cache locality.

Attempt to steal a StateActor from another ActorThread's queue. Used as a safety net for extreme load imbalance — the primary scheduling model keeps actors on their owning thread for CPU cache locality.

'''Idle tracking:''' idleCount is incremented each call (each idle event-loop iteration). It is reset when the owning thread has work. This ensures only genuinely idle threads attempt stealing.

'''Victim selection:''' random starting index distributes multiple idle thieves across different victims. The actual dequeue uses PriorityHouseQueue.stealDequeue (tryLock-based, no spinning) so that a contended victim is skipped instantly without delaying either the thief or the victim.

'''Steal condition:''' see stealableBy — combines idleCount with victim queue depth.

Attributes

Returns

true if a house was stolen and executed

Concrete fields