Class MaxSampler<T>

java.lang.Object
org.apache.cassandra.metrics.Sampler<T>
org.apache.cassandra.metrics.MaxSampler<T>

public abstract class MaxSampler<T> extends Sampler<T>
Note: Sampler.samplerExecutor is single threaded but we still need to synchronize as we have access from both internal and the external JMX context that can cause races.
  • Constructor Details

    • MaxSampler

      public MaxSampler()
  • Method Details

    • beginSampling

      public void beginSampling(int capacity, long durationMillis)
      Description copied from class: Sampler
      Begin sampling with the configured capacity and duration
      Specified by:
      beginSampling in class Sampler<T>
      Parameters:
      capacity - Number of sample items to keep in memory, the lower this is the less accurate results are. For best results use value close to cardinality, but understand the memory trade offs.
      durationMillis - Upperbound duration in milliseconds for sampling. The sampler stops accepting new samples after exceeding the duration even if Sampler.finishSampling(int)} is not called.
    • finishSampling

      public List<Sampler.Sample<T>> finishSampling(int count)
      Description copied from class: Sampler
      Stop sampling and return the results
      Specified by:
      finishSampling in class Sampler<T>
      Parameters:
      count - The number of the samples requested to retrieve from the sampler
      Returns:
      a list of samples, the size is the minimum of the total samples and .
    • insert

      protected void insert(T item, long value)
      Specified by:
      insert in class Sampler<T>