Interface LambdaGovernor
- All Known Implementing Classes:
BatchedLambdaGovernor
public interface LambdaGovernor
Schedules and executes
Runnable
tasks.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
LambdaGovernor.ErrorListener
-
Method Summary
Modifier and Type Method Description void
addErrorListener(LambdaGovernor.ErrorListener l)
Add a listener to handle errors from events within a scheduled job.List<RunnableFuture>
getAndClearCallbacks(Object key)
Get the callbacks for a given task.void
pause()
Pauses this governor's execution schedule.void
removeErrorListener(LambdaGovernor.ErrorListener l)
Remove an error listener.void
schedule(Object key, Runnable task)
Schedules when thetask
will run.void
schedule(Object key, Runnable task, RunnableFuture callback)
Schedules when thetask
will run.void
shutDown()
Shuts down this governor.void
start()
Starts this governor's execution schedule.
-
Method Details
-
start
void start()Starts this governor's execution schedule. -
pause
void pause()Pauses this governor's execution schedule. Tasks can still be added to the work queue. -
shutDown
void shutDown()Shuts down this governor. Tasks can no longer be added to the work queue. The currently running task will be allowed to execute until completion. This LambdaGovernor can not be restarted once shutDown is called. -
schedule
Schedules when thetask
will run.- Parameters:
key
-task
identifiertask
-Runnable
task
-
schedule
Schedules when thetask
will run. Adds thecallback
for the given key -
getAndClearCallbacks
Get the callbacks for a given task. Allows all callbacks to run after governor choking.- Parameters:
key
- task identifier- Returns:
- callbacks for the given key.
-
addErrorListener
Add a listener to handle errors from events within a scheduled job.- Parameters:
l
- the listener to add
-
removeErrorListener
Remove an error listener.- Parameters:
l
- the listener to remove
-