abstract const classstuds::Daemon

sys::Obj
  studs::Daemon

Daemon provides an API for long-running system services running on their own thread with life-cycle callbacks for start, stop, poll, and custom messages.

Daemon are managed by a DaemonSupervisor instance.

log

Source

const Log log

Log for this daemon.

make

Source

new make(Duration? pollFreq)

Subclass constructor where name is the name of this service, and pollFreq is the frequency to invoke onPoll callback, or null to not schedule a poll callback.

name

Source

Str name()

Programmtic name of this daemon, which by convention is simply the type name lowercased.

onMsg

Source

protected virtual Obj? onMsg(DaemonMsg m)

Callback to process a daemon message.

onPoll

Source

protected virtual Void onPoll()

Callback when periodic poll is dispatched.

onStart

Source

protected virtual Void onStart()

Callback when daemon is started.

onStop

Source

protected virtual Void onStop()

Callback when daemon is stopped.

send

Source

Void send(DaemonMsg m)

Send this daemon a message.