class Earl::Pool(A, M)
- Earl::Pool(A, M)
- Reference
- Object
Overview
Maintains a pool of worker agents of type A
that will be spawned and
monitored.
The pool will always be filled to its maximum capacity.
Workers
Crashed and unexpectedly stopped workers will be recycled and restarted, until the pool is asked to stop.
Worker agents can return as soon as possible when asked to stop, or keep processing their mailbox until its empty.
Mailbox
Workers must include the Mailbox(M)
module. Messages will be dispatched to
a single worker in an at-most-once manner.
Included Modules
Defined in:
pool.crConstructors
Instance Method Summary
- #call(message : M)
-
#call
Spawns workers in their dedicated
Fiber
. -
#terminate : Nil
Asks each worker to stop.
-
#trap(agent : A, exception : Exception | Nil) : Nil
Recycles and restarts crashed and unexpectedly stopped agents.
Instance methods inherited from module Earl::Mailbox(M)
mailbox=(mailbox : Channel(M)) : Channel(M)
mailbox=,
send(message : M) : Nil
send
Instance methods inherited from module Earl::Logger
log
log
Class methods inherited from module Earl::Logger
backends : Array(Backend)
backends,
debug(agent : Agent, message : String) : Nildebug(agent : Agent, &block : -> String) : Nil debug, debug? : Bool debug?, error(agent : Agent, message : String) : Nil
error(agent : Agent, &block : -> String) : Nil
error(agent : Agent, ex : Exception) error, error? : Bool error?, info(agent : Agent, message : String) : Nil
info(agent : Agent, &block : -> String) : Nil info, info? : Bool info?, level : Severity level, level=(severity : Severity) : Severity level=, silent? : Bool silent?, warn(agent : Agent, message : String) : Nil
warn(agent : Agent, &block : -> String) : Nil warn, warn? : Bool warn?
Instance methods inherited from module Earl::Agent
call
call,
crashed? : Bool
crashed?,
recycle : Nil
recycle,
recycling? : Bool
recycling?,
reset : Nil
reset,
running? : Bool
running?,
spawn(*, link : Agent | Nil = nil, _yield = true) : Nil
spawn,
start(*, link : Agent | Nil = nil) : Nil
start,
starting? : Bool
starting?,
stop : Nil
stop,
stopped? : Bool
stopped?,
stopping? : Bool
stopping?,
terminate : Nil
terminate,
trap(agent : Agent, exception : Exception | Nil) : Nil
trap
Instance methods inherited from module Earl::Artist(M)
call(message : M)call call
Constructor Detail
Instance Method Detail
def trap(agent : A, exception : Exception | Nil) : Nil
#
Recycles and restarts crashed and unexpectedly stopped agents.