DefaultProtocolWorker

class DefaultProtocolWorker(asynchronousThreshold: Int, executorService: ExecutorService) : ProtocolWorker

The default protocol worker, utilizing the calling thread if there are less than asynchronousThreshold callables to execute. Otherwise, utilizes the executorService to process the callables in parallel.

Constructors

Link copied to clipboard
constructor()

A default implementation that switches to parallel processing using ForkJoinPool if there are at least coreCount * 4 callables to execute. Otherwise, utilizes the calling thread.

constructor(asynchronousThreshold: Int, executorService: ExecutorService)

Functions

Link copied to clipboard
open override fun execute(callables: List<Callable<Unit>>)

Executes the callables collection as defined by the given worker's behavior. The callables may be executed asynchronously and are guaranteed to be thread-safe. It should be noted that all the callables must be called upon, or the protocol breaks.