executor-service

(executor-service name f)(executor-service name equiv-key f)

Creates a new threadpool executor service … service! Takes a function which generates an ExecutorService. Returns an ExecutorServiceService which provides start/stop/reload/equiv? lifecycle management of that service.

Equivalence-key controls how services are compared to tell if they are equivalent. Services with a nil equivalence key are never equivalent. Otherwise, services are equivalent when their class, name, and equiv-key are equal.

IExecutorServiceService

protocol

members

getExecutor

literal-executor-service

macro

(literal-executor-service name executor-service-expr)

Like executor-service, but captures the expression passed to it as the equivalence key. This only works if the expression is literal; if there are any variables or function calls, they will be compared as code, not as their evaluated values.

scheduled-task-service

(scheduled-task-service name equiv-key interval delay f)

Returns a ScheduledTaskService which will schedule a task which call (f core) repeatedly every interval after delay seconds. Equivalent to other ScheduledTaskService with the same name, equiv-key, delay and interval. Conflicts with other ScheduledTaskService of the same name.

reload!

start!

stop!

ServiceEquiv

protocol

members

equiv?

(equiv? service1 service2)

Used to identify which services can remain running through a core transition, like reloading. If the old service is equivalent to the new service, the old service may be preserved and used by the new core. Otherwise, the old service may be shut down and replaced by the new.

thread-service

(thread-service name f)(thread-service name equiv-key f)

Returns a ThreadService which will call (f core) repeatedly when started. Will only stop between calls to f. Start and stop are blocking operations. Equivalent to other ThreadServices with the same name and equivalence key– if not provided, defaults nil. Conflicts with other ThreadServices of the same name.