(after delay-ms
fun
pool
&
{:keys [desc re-throw-caught-exceptions? uid]
:or {desc "" re-throw-caught-exceptions? true uid false}})
Schedules fun to be executed after delay-ms (in milliseconds).
Example usage: (after 1000 #(println "hello from the past") pool :desc "Message from the past" :uid unique identifier as string (optional)) ;=> prints 1s from now
Schedules fun to be executed after delay-ms (in milliseconds). Example usage: (after 1000 #(println "hello from the past") pool :desc "Message from the past" :uid unique identifier as string (optional)) ;=> prints 1s from now
(at ms-time
fun
pool
&
{:keys [desc re-throw-caught-exceptions? uid]
:or {desc "" re-throw-caught-exceptions? true uid false}})
Schedules fun to be executed at ms-time (in milliseconds). Use (now) to get the current time in ms.
Example usage: (at (+ 1000 (now)) #(println "hello from the past") pool :desc "Message from the past" :uid unique identifier as string (optional)) ;=> prints 1s from now
Schedules fun to be executed at ms-time (in milliseconds). Use (now) to get the current time in ms. Example usage: (at (+ 1000 (now)) #(println "hello from the past") pool :desc "Message from the past" :uid unique identifier as string (optional)) ;=> prints 1s from now
(every ms-period
fun
pool
&
{:keys [initial-delay desc re-throw-caught-exceptions?]
:or {initial-delay 0 desc "" re-throw-caught-exceptions? true}})
Calls fun every ms-period, and takes an optional initial-delay for the first call in ms. Returns a scheduled-fn which may be cancelled with cancel.
Default options are {:initial-delay 0 :desc ""}
Calls fun every ms-period, and takes an optional initial-delay for the first call in ms. Returns a scheduled-fn which may be cancelled with cancel. Default options are {:initial-delay 0 :desc ""}
(interspaced ms-period
fun
pool
&
{:keys [initial-delay desc re-throw-caught-exceptions?]
:or {initial-delay 0 desc "" re-throw-caught-exceptions? true}})
Calls fun repeatedly with an interspacing of ms-period, i.e. the next call of fun will happen ms-period milliseconds after the completion of the previous call. Also takes an optional initial-delay for the first call in ms. Returns a scheduled-fn which may be cancelled with cancel.
Default options are {:initial-delay 0 :desc ""}
Calls fun repeatedly with an interspacing of ms-period, i.e. the next call of fun will happen ms-period milliseconds after the completion of the previous call. Also takes an optional initial-delay for the first call in ms. Returns a scheduled-fn which may be cancelled with cancel. Default options are {:initial-delay 0 :desc ""}
(kill job)
(kill id pool)
kill a recurring or scheduled job forcefully either using a corresponding record or unique id. If you specify an id, you also need to pass the associated pool.
kill a recurring or scheduled job forcefully either using a corresponding record or unique id. If you specify an id, you also need to pass the associated pool.
(mk-pool &
{:keys [cpu-count stop-delayed? stop-periodic?]
:or {cpu-count (+ 2 (cpu-count))}})
Returns MutablePool record storing a mutable reference (atom) to a PoolInfo record which contains a newly created pool of threads to schedule new events for. Pool size defaults to the cpu count + 2.
Returns MutablePool record storing a mutable reference (atom) to a PoolInfo record which contains a newly created pool of threads to schedule new events for. Pool size defaults to the cpu count + 2.
(scheduled-jobs pool)
Returns a set of all current jobs (both scheduled and recurring) for the specified pool.
Returns a set of all current jobs (both scheduled and recurring) for the specified pool.
(show-schedule pool)
Pretty print all of the pool's scheduled jobs
Pretty print all of the pool's scheduled jobs
(stop job)
(stop id pool)
Stop a recurring or scheduled job gracefully either using a corresponding record or unique id. If you specify an id, you also need to pass the associated pool.
Stop a recurring or scheduled job gracefully either using a corresponding record or unique id. If you specify an id, you also need to pass the associated pool.
(stop-and-reset-pool! pool & {:keys [strategy] :or {strategy :stop}})
Shuts down the threadpool of given MutablePool using the specified strategy (defaults to :stop). Shutdown happens asynchronously on a separate thread. The pool is reset to a fresh new pool preserving the original size. Returns the old pool-info.
Strategies for stopping the old pool: :stop - allows all running and scheduled tasks to complete before waiting :kill - forcefully interrupts all running tasks and does not wait
Example usage: (stop-and-reset-pool! pool) ;=> pool is reset gracefully (stop-and-reset-pool! pool :strategy :kill) ;=> pool is reset forcefully
Shuts down the threadpool of given MutablePool using the specified strategy (defaults to :stop). Shutdown happens asynchronously on a separate thread. The pool is reset to a fresh new pool preserving the original size. Returns the old pool-info. Strategies for stopping the old pool: :stop - allows all running and scheduled tasks to complete before waiting :kill - forcefully interrupts all running tasks and does not wait Example usage: (stop-and-reset-pool! pool) ;=> pool is reset gracefully (stop-and-reset-pool! pool :strategy :kill) ;=> pool is reset forcefully
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close