manifold.executor

execute-pool

(execute-pool)

executor

(executor)

executor-thread-local

fixed-thread-executor

(fixed-thread-executor num-threads)(fixed-thread-executor num-threads options)

Returns an executor which has a fixed number of threads.

instrumented-executor

(instrumented-executor {:keys [thread-factory queue-length stats-callback sample-period control-period controller metrics initial-thread-count onto?], :or {initial-thread-count 1, sample-period 25, control-period 10000, metrics (EnumSet/allOf Stats$Metric), onto? true}})

Returns a java.util.concurrent.ExecutorService, using Dirigiste.

thread-factory an optional java.util.concurrent.ThreadFactory that creates the executor’s threads.
queue-length the maximum number of pending tasks before .execute() begins throwing java.util.concurrent.RejectedExecutionException, defaults to 0.
stats-callback a function that will be invoked every control-period with the relevant statistics for the executor.
sample-period the interval, in milliseconds, between sampling the state of the executor for resizing and gathering statistics, defaults to 25.
control-period the interval, in milliseconds, between use of the controller to adjust the size of the executor, defaults to 10000.
controller the Dirigiste controller that is used to guide the pool’s size.
metrics an EnumSet of the metrics that should be gathered for the controller, defaults to all.
initial-thread-count the number of threads that the pool should begin with.
onto? if true, all streams and deferred generated in the scope of this executor will also be ‘on’ this executor.

register-execute-pool-stats-callback

(register-execute-pool-stats-callback c)

Registers a callback which will be called with execute-pool stats.

register-wait-pool-stats-callback

(register-wait-pool-stats-callback c)

Registers a callback which will be called with wait-pool stats.

stats->map

(stats->map s)(stats->map s quantiles)

Converts a Dirigiste Stats object into a map of values onto quantiles.

thread-factory

(thread-factory name-generator executor-promise)(thread-factory name-generator executor-promise stack-size)(thread-factory name-generator executor-promise stack-size daemon?)

unregister-execute-pool-stats-callback

(unregister-execute-pool-stats-callback c)

Unregisters a previous execute-pool stats callback.

unregister-wait-pool-stats-callback

(unregister-wait-pool-stats-callback c)

Unregisters a previous wait-pool stats callback.

utilization-executor

(utilization-executor utilization)(utilization-executor utilization max-threads)(utilization-executor utilization max-threads options)

Returns an executor which sizes the thread pool according to target utilization, within [0,1], up to max-threads. The queue-length for this executor is always 0, and by default has an unbounded number of threads.

wait-pool

(wait-pool)

with-executor

macro

(with-executor executor & body)