public interface

BucketedExecutor

com.atlassian.bitbucket.concurrent.BucketedExecutor<T extends java.io.Serializable>

Class Overview

Executor that groups submitted tasks in 'buckets' and asynchronously processes these buckets of tasks on worker threads. At construction time, a BucketedExecutorSettings is provided that defines the maximum concurrency level, the task bucketing logic and the BucketProcessor that's called for processing buckets of tasks.

Summary

Public Methods
void schedule(T task, long delay, TimeUnit timeUnit)
Add a task to be processed and schedule the BucketProcessor to process the task's bucket with a delay.
void shutdown()
Shuts down the executor and releases all resources acquired by the executor.
void submit(T task)
Submit a task for processing and schedule the BucketProcessor to process the task's bucket immediately.

Public Methods

public void schedule (T task, long delay, TimeUnit timeUnit)

Add a task to be processed and schedule the BucketProcessor to process the task's bucket with a delay. The task may still be processed earlier if a prior task for the same bucket has been scheduled to run before the scheduled time.

Parameters
task the task to submit
delay the processing delay
timeUnit the delay's timeUnit

public void shutdown ()

Shuts down the executor and releases all resources acquired by the executor. This shuts down the executor on the current node only. In a cluster, the corresponding executors will keep processing tasks until they're shut down.

public void submit (T task)

Submit a task for processing and schedule the BucketProcessor to process the task's bucket immediately. This is equivalent to calling schedule(Serializable, long, TimeUnit) with a delay of 0.

Parameters
task the task to submit