Interface RequestController

All Known Implementing Classes:
SimpleRequestController

@Public public interface RequestController
An interface for client request scheduling algorithm.
  • Method Details

    • newChecker

      Returns A new checker for evaluating a batch rows.
    • incTaskCounters

      void incTaskCounters(Collection<byte[]> regions, ServerName sn)
      Increment the counter if we build a valid task.
      Parameters:
      regions - The destination of task
      sn - The target server
    • decTaskCounters

      void decTaskCounters(Collection<byte[]> regions, ServerName sn)
      Decrement the counter if a task is accomplished.
      Parameters:
      regions - The destination of task
      sn - The target server
    • getNumberOfTasksInProgress

      Returns The number of running task.
    • waitForMaximumCurrentTasks

      void waitForMaximumCurrentTasks(long max, long id, int periodToTrigger, Consumer<Long> trigger) throws InterruptedIOException
      Waits for the running tasks to complete. If there are specified threshold and trigger, the implementation should wake up once in a while for checking the threshold and calling trigger.
      Parameters:
      max - This method will return if the number of running tasks is less than or equal to max.
      id - the caller's id
      periodToTrigger - The period to invoke the trigger. This value is a hint. The real period depends on the implementation.
      trigger - The object to call periodically.
      Throws:
      InterruptedIOException - If the waiting is interrupted
    • waitForFreeSlot

      void waitForFreeSlot(long id, int periodToTrigger, Consumer<Long> trigger) throws InterruptedIOException
      Wait until there is at least one slot for a new task.
      Parameters:
      id - the caller's id
      periodToTrigger - The period to invoke the trigger. This value is a hint. The real period depends on the implementation.
      trigger - The object to call periodically.
      Throws:
      InterruptedIOException - If the waiting is interrupted