Package org.apache.cassandra.metrics
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.metrics.Sampler
Sampler.Sample<S>, Sampler.SamplerType
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.metrics.Sampler
samplerExecutor
-
-
Constructor Summary
Constructors Constructor Description MaxSampler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginSampling(int capacity, long durationMillis)
Begin sampling with the configured capacity and durationjava.util.List<Sampler.Sample<T>>
finishSampling(int count)
Stop sampling and return the resultsprotected void
insert(T item, long value)
-
Methods inherited from class org.apache.cassandra.metrics.Sampler
addSample, disable, isActive, isEnabled, shutdownNowAndWait, toString, updateEndTime
-
-
-
-
Method Detail
-
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 classSampler<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 ifSampler.finishSampling(int)
} is not called.
-
finishSampling
public java.util.List<Sampler.Sample<T>> finishSampling(int count)
Description copied from class:Sampler
Stop sampling and return the results- Specified by:
finishSampling
in classSampler<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 {@param count}.
-
-