Interface RequestLimiter<C>

    • Method Detail

      • tryAcquire

        boolean tryAcquire​(int streamId,
                           long requestId,
                           C context)
        Try to add to the inflight requests. If success, onResponse(int, long) ()} must be called when the request * is processed.
        Parameters:
        streamId -
        requestId -
        context - some limiters may use additional context to decide if a request should be accepted
        Returns:
        true if request is added to the inflight requests, false otherwise
      • onResponse

        void onResponse​(int streamId,
                        long requestId)
        Notify when a request processing is completed by calling this method.
        Parameters:
        streamId -
        requestId -
      • onIgnore

        void onIgnore​(int streamId,
                      long requestId)
        Notify when a request is cancelled after tryAcquire(int, long, Object) was success.
        Parameters:
        streamId -
        requestId -
      • getLimit

        int getLimit()
      • getInflightCount

        int getInflightCount()