ClearableScheduledExecutorService

Wrapper class for ScheduledExecutorService that supports cancelAllJobs operation. To support this, we keep internal variable futures.

Note that jobs registered via invokeAny calls are not cancelled by cancelAllJobs - since the jobs are automatically cancelled for these methods. See invokeAny.

All access to the internal variable futures must be synchronized.

Constructors

Functions

Link copied to clipboard
open fun awaitTermination(timeout: Long, @NonNull unit: TimeUnit): Boolean
Link copied to clipboard
open fun cancelAllJobs()
open fun cancelAllJobs(mayInterruptIfRunning: Boolean)
Link copied to clipboard
open fun execute(@NonNull command: Runnable)
Link copied to clipboard
open fun <T> invokeAll(@NonNull tasks: Collection<out Callable<T>>): List<Future<T>>
open fun <T> invokeAll(@NonNull tasks: Collection<out Callable<T>>, timeout: Long, @NonNull unit: TimeUnit): List<Future<T>>
Link copied to clipboard
open fun <T> invokeAny(@NonNull tasks: Collection<out Callable<T>>): T
open fun <T> invokeAny(@NonNull tasks: Collection<out Callable<T>>, timeout: Long, @NonNull unit: TimeUnit): T
Link copied to clipboard
open fun isShutdown(): Boolean
Link copied to clipboard
open fun isTerminated(): Boolean
Link copied to clipboard
open fun schedule(@NonNull command: Runnable, delay: Long, @NonNull unit: TimeUnit): ScheduledFuture<out Any>
open fun <V> schedule(@NonNull callable: Callable<V>, delay: Long, @NonNull unit: TimeUnit): ScheduledFuture<V>
Link copied to clipboard
open fun scheduleAtFixedRate(@NonNull command: Runnable, initialDelay: Long, period: Long, @NonNull unit: TimeUnit): ScheduledFuture<out Any>
Link copied to clipboard
open fun scheduleWithFixedDelay(@NonNull command: Runnable, initialDelay: Long, delay: Long, @NonNull unit: TimeUnit): ScheduledFuture<out Any>
Link copied to clipboard
open fun shutdown()
Link copied to clipboard
Link copied to clipboard
open fun submit(@NonNull task: Runnable): Future<out Any>
open fun <T> submit(@NonNull task: Callable<T>): Future<T>
open fun <T> submit(@NonNull task: Runnable, result: T): Future<T>