Interface WorkQueue.TaskParker
- All Superinterfaces:
WorkQueue.TaskListener
- All Known Implementing Classes:
WorkQueue.TaskParker.NoOp
- Enclosing class:
WorkQueue
bind(TaskListener.class).annotatedWith(Exports.named("MyParker")).to(MyParker.class);
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionboolean
isReadyToStart
(WorkQueue.Task<?> task) Determine whether aWorkQueue.Task
is ready to run or whether it should get parked.void
onNotReadyToStart
(WorkQueue.Task<?> task) This method will be called after thisWorkQueue.TaskParker
returnstrue
fromisReadyToStart(Task)
and anotherWorkQueue.TaskParker
returnsfalse
, thus preventing the start.Methods inherited from interface com.google.gerrit.server.git.WorkQueue.TaskListener
onStart, onStop
-
Method Details
-
isReadyToStart
Determine whether aWorkQueue.Task
is ready to run or whether it should get parked.Tasks that are not ready to run will get parked and will not run until all
WorkQueue.TaskParker
s returntrue
from this method for theWorkQueue.Task
. This method may be called more than once, but will always be followed by a call toonNotReadyToStart(Task)
before being called again.Resources should be acquired in this method via non-blocking means to avoid delaying the executor from calling
onNotReadyToStart(Task)
on otherWorkQueue.TaskParker
s holding resources.- Parameters:
task
- theWorkQueue.Task
being considered for starting/parking- Returns:
- a boolean indicating if the given
WorkQueue.Task
is ready to run (true
) or should be parked (false
)
-
onNotReadyToStart
This method will be called after thisWorkQueue.TaskParker
returnstrue
fromisReadyToStart(Task)
and anotherWorkQueue.TaskParker
returnsfalse
, thus preventing the start.Implementors should use this method to free any resources acquired in
isReadyToStart(Task)
based on the expectation that the task would start. Those resources can be re-acquired whenisReadyToStart(Task)
is called again later.- Parameters:
task
- theWorkQueue.Task
that was prevented from starting by anotherWorkQueue.TaskParker
-