Interface LambdaGovernor

All Known Implementing Classes:
BatchedLambdaGovernor

public interface LambdaGovernor
Schedules and executes Runnable tasks.
  • 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

      void schedule​(Object key, Runnable task)
      Schedules when the task will run.
      Parameters:
      key - task identifier
      task - Runnable task
    • schedule

      void schedule​(Object key, Runnable task, RunnableFuture callback)
      Schedules when the task will run. Adds the callback for the given key
      Parameters:
      key - task identifier
      task - Runnable task
      callback - Runnable run once task is complete.
    • getAndClearCallbacks

      List<RunnableFuture> getAndClearCallbacks​(Object key)
      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

      void addErrorListener​(LambdaGovernor.ErrorListener l)
      Add a listener to handle errors from events within a scheduled job.
      Parameters:
      l - the listener to add
    • removeErrorListener

      void removeErrorListener​(LambdaGovernor.ErrorListener l)
      Remove an error listener.
      Parameters:
      l - the listener to remove