Liking cljdoc? Tell your friends :D

aleph.flow


acquireclj

(acquire p k)

Acquires an object from the pool for key k, returning a deferred containing the object. May throw a java.util.concurrent.RejectedExecutionException if there are too many pending acquires.

Acquires an object from the pool for key `k`, returning a deferred containing the object.  May
throw a `java.util.concurrent.RejectedExecutionException` if there are too many pending acquires.
sourceraw docstring

disposeclj

(dispose p k obj)

Disposes of a pooled object which is no longer valid.

Disposes of a pooled object which is no longer valid.
sourceraw docstring

fixed-thread-executorclj

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

Returns an executor which has a fixed number of threads.

Returns an executor which has a fixed number of threads.
sourceraw docstring

instrumented-executorclj

(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.

Returns a `java.util.concurrent.ExecutorService`, using [Dirigiste](https://github.com/ztellman/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.
sourceraw docstring

instrumented-poolclj

(instrumented-pool
  {:keys [generate destroy stats-callback max-queue-size sample-period
          control-period controller]
   :or {sample-period 10 control-period 10000 max-queue-size 65536}})

Returns a Dirigiste object pool, which can be interacted with via acquire, release, and dispose.

|:---|:---- | generate | a single-arg funcion which takes a key, and returns an object which should be non-equal to any other generated object | | destroy | an optional two-arg function which takes a key and object, and releases any associated resources | | stats-callback | a function which will be invoked every control-period with a map of keys onto associated statistics | | max-queue-size | the maximum number of pending acquires per key that are allowed before acquire will start to throw a java.util.concurrent.RejectedExecutionException. | sample-period | the interval, in milliseconds, between sampling the state of the pool for resizing and gathering statistics, defaults to 10. | control-period | the interval, in milliseconds, between use of the controller to adjust the size of the pool, defaults to 10000. | controller | a Dirigiste controller that is used to gide the pool's size.

Returns a [Dirigiste](https://github.com/ztellman/dirigiste) object pool, which can be interacted
with via `acquire`, `release`, and `dispose`.

|:---|:----
| `generate` | a single-arg funcion which takes a key, and returns an object which should be non-equal to any other generated object |
| `destroy` | an optional two-arg function which takes a key and object, and releases any associated resources |
| `stats-callback` | a function which will be invoked every `control-period` with a map of keys onto associated statistics |
| `max-queue-size` | the maximum number of pending acquires per key that are allowed before `acquire` will start to throw a `java.util.concurrent.RejectedExecutionException`.
| `sample-period` | the interval, in milliseconds, between sampling the state of the pool for resizing and gathering statistics, defaults to `10`.
| `control-period` | the interval, in milliseconds, between use of the controller to adjust the size of the pool, defaults to `10000`.
| `controller` | a Dirigiste controller that is used to gide the pool's size.
sourceraw docstring

releaseclj

(release p k obj)

Releases an object for key k back to the pool.

Releases an object for key `k` back to the pool.
sourceraw docstring

utilization-executorclj

(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.

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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close