(executor type)(executor type
&
{:keys [thread-factory num-threads] :or {num-threads 1} :as _opts})Returns an instances of an ExecutorService of the corresponding type.
Parameters:
type — the executor type, which can be :single, :cached, :fixed,
:scheduled, :scheduled-single, :thread-per-task, :virtual;opts — an options map that may include:
:thread-factory — a custom ThreadFactory instance to use for threads
creation, otherwise a default one is used;:num-threads — for :fixed or :scheduled executor, 1 by default.Returns an instances of an `ExecutorService` of the corresponding type.
Parameters:
- `type` — the executor type, which can be `:single`, `:cached`, `:fixed`,
`:scheduled`, `:scheduled-single`, `:thread-per-task`, `:virtual`;
- `opts` — an options map that may include:
- `:thread-factory` — a custom `ThreadFactory` instance to use for threads
creation, otherwise a default one is used;
- `:num-threads` — for `:fixed` or `:scheduled` executor, 1 by default.(future body-expr+ ?options)Takes a body of expressions with the map of options and yields a future
object that will invoke the body in another (executor's) thread, and will
cache the result and return it on all subsequent calls to deref/@.
If the computation has not yet finished, calls to deref/@ will block,
unless the variant of deref with timeout is used. See also — realized?.
A variant of the clojure.core/future that supports following options:
:preserve-bindings? — true by default; if false, won't convey the
current thread bindings to the executor thread;:executor — the Agent/soloExecutor by default.Takes a body of expressions with the map of `options` and yields a future
object that will invoke the body in another (executor's) thread, and will
cache the result and return it on all subsequent calls to `deref`/`@`.
If the computation has not yet finished, calls to `deref`/`@` will block,
unless the variant of deref with timeout is used. See also — `realized?`.
A variant of the `clojure.core/future` that supports following `options`:
- `:preserve-bindings?` — `true` by default; if `false`, won't convey the
current thread bindings to the executor thread;
- `:executor` — the `Agent/soloExecutor` by default.(future-call f
{:keys [preserve-bindings? executor]
:or {preserve-bindings? true executor Agent/soloExecutor}
:as _options})A variant of the clojure.core/future-call aux fn that supports options.
A variant of the `clojure.core/future-call` aux fn that supports `options`.
(schedule f)(schedule type f)(schedule type
f
&
{:keys [executor delay initial-delay unit]
:or {delay 0 initial-delay 0 unit :milliseconds}
:as _opts})Schedules the given fn f for execution and returns a ScheduledFuture.
Parameters:
f — a no-arg function to be scheduled for execution;type — can be :once (default), :at-fixed-rate, :with-fixed-delay;opts — an options map that may include:
:executor — a ScheduledExecutorService to schedule the task on;
when not provided, a single-threaded :scheduled is
created and used by default;:delay — for :once — the time from now to delay execution;
for :at-fixed-rate — the period between successive
executions;
for type :with-fixed-delay — the delay between the
termination of one execution and the commencement of
the next;
0 by default, meaning no delay;:initial-delay — the time to delay first execution;:unit — the time unit of the :delay and :initial-delay;
it's a keywordized name of the TimeUnit enum value,
:milliseconds by default.Schedules the given fn `f` for execution and returns a `ScheduledFuture`.
Parameters:
- `f` — a no-arg function to be scheduled for execution;
- `type` — can be `:once` (default), `:at-fixed-rate`, `:with-fixed-delay`;
- `opts` — an options map that may include:
- `:executor` — a `ScheduledExecutorService` to schedule the task on;
when not provided, a single-threaded `:scheduled` is
created and used by default;
- `:delay` — for `:once` — the time from now to delay execution;
for `:at-fixed-rate` — the period between successive
executions;
for type `:with-fixed-delay` — the delay between the
termination of one execution and the commencement of
the next;
0 by default, meaning no delay;
- `:initial-delay` — the time to delay first execution;
- `:unit` — the time unit of the `:delay` and `:initial-delay`;
it's a keywordized name of the `TimeUnit` enum value,
`:milliseconds` by default.(submit executor f)Submits the given fn f to the specified executor and returns a Future.
Submits the given fn `f` to the specified `executor` and returns a `Future`.
(thread-factory & {:keys [fmt priority daemon]})Returns a new ThreadFactory instance to be used in the executor.
Returns a new `ThreadFactory` instance to be used in the `executor`.
(thread-group name)(thread-group parent name)Returns a new ThreadGroup instance to be used in the thread-factory.
Returns a new `ThreadGroup` instance to be used in the `thread-factory`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |