Class LocalBucketBuilder


  • public class LocalBucketBuilder
    extends Object
    This builder creates in-memory buckets (LockFreeBucket).
    • Constructor Detail

      • LocalBucketBuilder

        public LocalBucketBuilder()
    • Method Detail

      • addLimit

        public LocalBucketBuilder addLimit​(Bandwidth bandwidth)
        Adds limited bandwidth for all buckets which will be constructed by this builder.
        Parameters:
        bandwidth - limitation
        Returns:
        this builder instance
      • withCustomTimePrecision

        public LocalBucketBuilder withCustomTimePrecision​(TimeMeter customTimeMeter)
        Specifies customTimeMeter time meter for buckets that will be created by this builder.
        Parameters:
        customTimeMeter - object which will measure time.
        Returns:
        this builder instance
      • withSynchronizationStrategy

        public LocalBucketBuilder withSynchronizationStrategy​(SynchronizationStrategy synchronizationStrategy)
        Specifies synchronizationStrategy for buckets that will be created by this builder.
        Parameters:
        synchronizationStrategy - the strategy of synchronization which need to be applied to prevent data-races in multi-threading usage scenario.
        Returns:
        this builder instance
      • withListener

        public LocalBucketBuilder withListener​(BucketListener listener)
        Specifies listener for buckets that will be created by this builder.
        Parameters:
        listener - the listener of bucket events.
        Returns:
        this builder instance
      • build

        public LocalBucket build()
        Constructs the bucket.
        Returns:
        the new bucket