class Earl::Application
- Earl::Application
- Earl::Supervisor
- Reference
- Object
Overview
A singleton Supervisor
accessible as Earl.application
with additional
features suited for programs:
- traps the SIGINT and SIGTERM signals to exit cleanly;
- adds an
at_exit
handler to ask supervised agents to stop gracefully.
The Logger
agent, among other possible agents, expect that
Earl.application
will be started. Programs must always start it. Either
spawned in the background (and forgotten) or leveraged to monitor the
program agents, and block the main Fiber
until the program is told to
terminate.
Defined in:
application.crInstance Method Summary
Instance methods inherited from class Earl::Supervisor
call
call,
monitor(agent : Agent) : Nil
monitor,
reset : Nil
reset,
terminate : Nil
terminate,
trap(agent : Agent, exception : Exception | Nil) : Nil
trap
Constructor methods inherited from class Earl::Supervisor
new
new
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 Method Detail
def call
#
Traps signals. Adds an at_exit
handler then delegates to Supervisor
which will block until all supervised actors are asked to terminate.
def signals
#
List of POSIX signals to trap. Defaults to SIGINT
and SIGTERM
. The
list may only be changed prior to starting the application.