ResourceLimiter (Cloud Bigtable HBase Client for Java 0.9.3-SNAPSHOT API)

com.google.cloud.bigtable.grpc.async

Class ResourceLimiter



  • public class ResourceLimiter
    extends Object
    This class limits access by RPCs to system resources
    Version:
    $Id: $Id
    Author:
    sduskis
    • Constructor Detail

      • ResourceLimiter

        public ResourceLimiter(long maxHeapSize,
                               int maxInFlightRpcs)

        Constructor for ResourceLimiter.

        Parameters:
        maxHeapSize - a long.
        maxInFlightRpcs - a int.
    • Method Detail

      • registerOperationWithHeapSize

        public long registerOperationWithHeapSize(long heapSize)
                                           throws InterruptedException
        Register an operation with the given size before sending. This call WILL BLOCK until resources are available. This method must be paired with a call to markCanBeCompleted in order to make sure resources are properly released.
        Parameters:
        heapSize - The serialized size of the RPC to be sent
        Returns:
        A unique operation id
        Throws:
        InterruptedException - if any.
      • markCanBeCompleted

        public void markCanBeCompleted(long id)
        Mark an operation id, as returned by registerOperationWithHeapSize, as complete
        Parameters:
        id - a long.
      • getMaxHeapSize

        public long getMaxHeapSize()

        Getter for the field maxHeapSize.

        Returns:
        The maximum allowed number of bytes across all across all outstanding RPCs
      • getMaxInFlightRpcs

        public int getMaxInFlightRpcs()

        Getter for the field maxInFlightRpcs.

        Returns:
        The maximum allowed number of in-flight RPCs
      • getHeapSize

        public long getHeapSize()

        getHeapSize.

        Returns:
        The total size of all currently outstanding RPCs
      • isFull

        public boolean isFull()

        isFull.

        Returns:
        true if no more RPCs can be started, false otherwise
      • hasInflightRequests

        public boolean hasInflightRequests()

        hasInflightRequests.

        Returns:
        true if there are currently in-flight RPCs


Send feedback about...

Cloud Bigtable Documentation