Package org.apache.hadoop.hbase.client
Interface RequestController
- All Known Implementing Classes:
SimpleRequestController
An interface for client request scheduling algorithm.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Picks up the valid data.static enum
-
Method Summary
Modifier and TypeMethodDescriptionvoid
decTaskCounters
(Collection<byte[]> regions, ServerName sn) Decrement the counter if a task is accomplished.long
Returns The number of running task.void
incTaskCounters
(Collection<byte[]> regions, ServerName sn) Increment the counter if we build a valid task.Returns A new checker for evaluating a batch rows.void
waitForFreeSlot
(long id, int periodToTrigger, Consumer<Long> trigger) Wait until there is at least one slot for a new task.void
waitForMaximumCurrentTasks
(long max, long id, int periodToTrigger, Consumer<Long> trigger) Waits for the running tasks to complete.
-
Method Details
-
newChecker
Returns A new checker for evaluating a batch rows. -
incTaskCounters
Increment the counter if we build a valid task.- Parameters:
regions
- The destination of tasksn
- The target server
-
decTaskCounters
Decrement the counter if a task is accomplished.- Parameters:
regions
- The destination of tasksn
- The target server
-
getNumberOfTasksInProgress
long 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 idperiodToTrigger
- 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 idperiodToTrigger
- 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
-