Class PublishRateLimiterImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      PublishRateLimiterImpl​(org.apache.pulsar.common.policies.data.Policies policies, java.lang.String clusterName)  
      PublishRateLimiterImpl​(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkPublishRate()
      checks and update state of current publish and marks if it has exceeded the rate-limiting threshold.
      void close()
      Close the limiter.
      void incrementPublishCount​(int numOfMessages, long msgSizeInBytes)
      increments current publish count.
      boolean isPublishRateExceeded()
      returns true if current publish has reached the rate-limiting threshold.
      boolean resetPublishCount()
      reset current publish count.
      boolean tryAcquire​(int numbers, long bytes)
      try to acquire permit.
      void update​(org.apache.pulsar.common.policies.data.Policies policies, java.lang.String clusterName)
      updates rate-limiting threshold based on policies.
      void update​(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)
      updates rate-limiting threshold based on passed in rate limiter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • publishMaxMessageRate

        protected volatile int publishMaxMessageRate
      • publishMaxByteRate

        protected volatile long publishMaxByteRate
      • publishThrottlingEnabled

        protected volatile boolean publishThrottlingEnabled
      • publishRateExceeded

        protected volatile boolean publishRateExceeded
      • currentPublishMsgCount

        protected volatile java.util.concurrent.atomic.LongAdder currentPublishMsgCount
      • currentPublishByteCount

        protected volatile java.util.concurrent.atomic.LongAdder currentPublishByteCount
    • Constructor Detail

      • PublishRateLimiterImpl

        public PublishRateLimiterImpl​(org.apache.pulsar.common.policies.data.Policies policies,
                                      java.lang.String clusterName)
      • PublishRateLimiterImpl

        public PublishRateLimiterImpl​(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)
    • Method Detail

      • checkPublishRate

        public void checkPublishRate()
        Description copied from interface: PublishRateLimiter
        checks and update state of current publish and marks if it has exceeded the rate-limiting threshold.
        Specified by:
        checkPublishRate in interface PublishRateLimiter
      • update

        public void update​(org.apache.pulsar.common.policies.data.Policies policies,
                           java.lang.String clusterName)
        Description copied from interface: PublishRateLimiter
        updates rate-limiting threshold based on policies.
        Specified by:
        update in interface PublishRateLimiter
      • update

        public void update​(org.apache.pulsar.common.policies.data.PublishRate maxPublishRate)
        Description copied from interface: PublishRateLimiter
        updates rate-limiting threshold based on passed in rate limiter.
        Specified by:
        update in interface PublishRateLimiter
      • close

        public void close()
        Description copied from interface: PublishRateLimiter
        Close the limiter.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface PublishRateLimiter