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

com.google.cloud.bigtable.grpc.async

Class RpcThrottler



  • public class RpcThrottler
    extends Object
    Throttles the number of RPCs that are outstanding at any point in time.
    Version:
    $Id: $Id
    Author:
    sduskis
    • Field Detail

      • LOG

        protected static final Logger LOG
        Constant LOG
    • Constructor Detail

      • RpcThrottler

        public RpcThrottler(ResourceLimiter resourceLimiter)

        Constructor for RpcThrottler.

        Parameters:
        resourceLimiter - a ResourceLimiter object.
    • Method Detail

      • registerOperationWithHeapSize

        public long registerOperationWithHeapSize(long heapSize)
                                           throws InterruptedException
        Register a new RPC operation. Blocks until the requested resources are available. This method must be paired with a call to addCallback.
        Parameters:
        heapSize - The serialized size of the RPC
        Returns:
        An operation id
        Throws:
        InterruptedException - if any.
      • addCallback

        public <T> FutureCallback<T> addCallback(ListenableFuture<T> future,
                                                 long id)
        Add a callback to a Future representing an RPC call with the given operation id that will clean upon completion and reclaim any utilized resources. This method must be paired with every call to registerOperationWithHeapSize.
        Type Parameters:
        T - a T object.
        Parameters:
        future - a ListenableFuture object.
        id - a long.
        Returns:
        a FutureCallback object.
      • registerRetry

        public <T> long registerRetry()
        Registers a retry, if a retry is necessary, it will be complete before a call to awaitCompletion returns. Retries do not count against any RPC resource limits.
        Type Parameters:
        T - a T object.
        Returns:
        a long.
      • getMaxHeapSize

        public long getMaxHeapSize()

        getMaxHeapSize.

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

        public boolean hasInflightRequests()

        hasInflightRequests.

        Returns:
        true if there are any outstanding requests being tracked by this throttler
      • onRetryCompletion

        public void onRetryCompletion(long id)

        onRetryCompletion.

        Parameters:
        id - a long.


Send feedback about...

Cloud Bigtable Documentation