Package com.aerospike.client.async
Class Throttle
java.lang.Object
com.aerospike.client.async.Throttle
Limit the number of commands allowed at any point in time.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSlot
(int count) Recover slot(s) from commands that have completed.int
Get current number of commands that could be run.boolean
waitForSlot
(int count) Wait for command slot(s).
-
Constructor Details
-
Throttle
public Throttle(int capacity) Construct throttle with max number of commands.
-
-
Method Details
-
waitForSlot
public boolean waitForSlot(int count) Wait for command slot(s).- Parameters:
count
- count of commands to reserve- Returns:
- if command should be processed
-
addSlot
public void addSlot(int count) Recover slot(s) from commands that have completed.- Parameters:
count
- count of commands to reclaim
-
getAvailable
public int getAvailable()Get current number of commands that could be run.
-