Package com.google.gerrit.server.git
Class WorkQueue
java.lang.Object
com.google.gerrit.server.git.WorkQueue
Delayed execution of tasks using a background thread pool.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceRunnable needing to know it was canceled.static interfaceBase interface handles the case when task was canceled before actual execution and in case it was started cancel method is not called yet the task itself will be destroyed anyway (it will result in resource opening errors).static classstatic classSame as Task class, but with a reference to ProjectRunnable, used to retrieve the project name from the operation queuedstatic classA wrapper around a scheduled Runnable, as maintained in the queue.static interfaceTo register a TaskListener, which will be called directly before Tasks run, and directly after they complete, bind the TaskListener like this:static class
- 
Constructor SummaryConstructorsConstructorDescriptionWorkQueue(IdGenerator idGenerator, int defaultThreadPoolSize, com.google.gerrit.metrics.MetricMaker metrics, PluginMapContext<WorkQueue.TaskListener> listeners) Constructor to allow binding the WorkQueue more explicitly in a vhost setup.
- 
Method SummaryModifier and TypeMethodDescriptioncreateQueue(int poolsize, String queueName) Create a new executor queue.createQueue(int poolsize, String queueName, boolean withMetrics) Create a new executor queue, with default priority, optionally with metrics.createQueue(int poolsize, String queueName, int threadPriority, boolean withMetrics) Create a new executor queue, optionally with metrics.Get the default work queue, for miscellaneous tasks.getExecutor(String queueName) getTask(int id) Locate a task by its unique id, null if no task matches.<T> List<T>getTaskInfos(TaskInfoFactory<T> factory) List<WorkQueue.Task<?>>getTasks()Get all of the tasks currently scheduled in any work queue.voidscheduleAtFixedRate(Runnable command, ScheduleConfig.Schedule schedule) Executes a periodic command at a fixed schedule on the default queue.
- 
Constructor Details- 
WorkQueuepublic WorkQueue(IdGenerator idGenerator, int defaultThreadPoolSize, com.google.gerrit.metrics.MetricMaker metrics, PluginMapContext<WorkQueue.TaskListener> listeners) Constructor to allow binding the WorkQueue more explicitly in a vhost setup.
 
- 
- 
Method Details- 
getDefaultQueueGet the default work queue, for miscellaneous tasks.
- 
createQueueCreate a new executor queue.Creates a new executor queue without associated metrics. This method is suitable for use by plugins. If metrics are needed, use createQueue(int, String, int, boolean)instead.- Parameters:
- poolsize- the size of the pool.
- queueName- the name of the queue.
 
- 
createQueueCreate a new executor queue, with default priority, optionally with metrics.Creates a new executor queue, optionally with associated metrics. Metrics should not be requested for queues created by plugins. - Parameters:
- poolsize- the size of the pool.
- queueName- the name of the queue.
- withMetrics- whether to create metrics.
 
- 
createQueuepublic ScheduledThreadPoolExecutor createQueue(int poolsize, String queueName, int threadPriority, boolean withMetrics) Create a new executor queue, optionally with metrics.Creates a new executor queue, optionally with associated metrics. Metrics should not be requested for queues created by plugins. - Parameters:
- poolsize- the size of the pool.
- queueName- the name of the queue.
- threadPriority- thread priority.
- withMetrics- whether to create metrics.
 
- 
scheduleAtFixedRateExecutes a periodic command at a fixed schedule on the default queue.
- 
getTasksGet all of the tasks currently scheduled in any work queue.
- 
getTaskInfos
- 
getTaskLocate a task by its unique id, null if no task matches.
- 
getExecutor
 
-