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 TypeMethodDescriptionbooleanisReadyToStart(WorkQueue.Task<?> task) Determine whether aWorkQueue.Taskis ready to run or whether it should get parked.voidonNotReadyToStart(WorkQueue.Task<?> task) This method will be called after thisWorkQueue.TaskParkerreturnstruefromisReadyToStart(Task)and anotherWorkQueue.TaskParkerreturnsfalse, thus preventing the start.Methods inherited from interface com.google.gerrit.server.git.WorkQueue.TaskListener
onStart, onStop
-
Method Details
-
isReadyToStart
Determine whether aWorkQueue.Taskis 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.TaskParkers returntruefrom 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.TaskParkers holding resources.- Parameters:
task- theWorkQueue.Taskbeing considered for starting/parking- Returns:
- a boolean indicating if the given
WorkQueue.Taskis ready to run (true) or should be parked (false)
-
onNotReadyToStart
This method will be called after thisWorkQueue.TaskParkerreturnstruefromisReadyToStart(Task)and anotherWorkQueue.TaskParkerreturnsfalse, 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.Taskthat was prevented from starting by anotherWorkQueue.TaskParker
-