Class Throttle

java.lang.Object
com.aerospike.client.async.Throttle

public final class Throttle extends Object
Limit the number of commands allowed at any point in time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Throttle(int capacity)
    Construct throttle with max number of commands.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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).

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.