Package org.infinispan.stats.topK
Class StreamSummaryContainer
- java.lang.Object
-
- org.infinispan.stats.topK.StreamSummaryContainer
-
public class StreamSummaryContainer extends Object
This contains all the stream lib top keys. Stream lib is a space efficient technique to obtains the top-most counters.- Since:
- 6.0
- Author:
- Pedro Ruivo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StreamSummaryContainer.Stat
-
Constructor Summary
Constructors Constructor Description StreamSummaryContainer(String cacheName, String address)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGet(Object key, boolean remote)
Adds the key to the read top-key.void
addLockInformation(Object key, boolean contention, boolean failLock)
Adds the lock information about the key, namely if the key suffer some contention and if the keys was locked or not.void
addPut(Object key, boolean remote)
Adds the key to the put top-key.void
addWriteSkewFailed(Object key)
Adds the key to the write skew failed top-key.boolean
equals(Object o)
int
getCapacity()
static StreamSummaryContainer
getOrCreateStreamLibContainer(Cache cache)
Map<Object,Long>
getTopKFrom(StreamSummaryContainer.Stat stat)
Map<Object,Long>
getTopKFrom(StreamSummaryContainer.Stat stat, int topK)
Map<String,Long>
getTopKFromAsKeyString(StreamSummaryContainer.Stat stat)
Same asgetTopKFrom(org.infinispan.stats.topK.StreamSummaryContainer.Stat)
but the keys are returned in their String format.Map<String,Long>
getTopKFromAsKeyString(StreamSummaryContainer.Stat stat, int topK)
Same asgetTopKFrom(org.infinispan.stats.topK.StreamSummaryContainer.Stat, int)
but the keys are returned in their String format.int
hashCode()
boolean
isEnabled()
void
resetAll()
Resets all the top-key collected so far.void
setCapacity(int capacity)
Sets the capacity of the top-key.void
setEnabled(boolean enabled)
Enables or disables the top-key collectionString
toString()
void
tryFlushAll()
Tries to flush all the enqueue offers to be visible globally.
-
-
-
Method Detail
-
getOrCreateStreamLibContainer
public static StreamSummaryContainer getOrCreateStreamLibContainer(Cache cache)
-
isEnabled
public boolean isEnabled()
- Returns:
true
if the top-key collection is enabled,false
otherwise.
-
setEnabled
public void setEnabled(boolean enabled)
Enables or disables the top-key collection
-
getCapacity
public int getCapacity()
-
setCapacity
public void setCapacity(int capacity)
Sets the capacity of the top-key. The capacity defines the maximum number of keys that are tracked. Remember that top-key is a probabilistic counter so the higher the number of keys, the more precise will be the counters
-
addGet
public void addGet(Object key, boolean remote)
Adds the key to the read top-key.- Parameters:
remote
-true
if the key is remote,false
otherwise.
-
addPut
public void addPut(Object key, boolean remote)
Adds the key to the put top-key.- Parameters:
remote
-true
if the key is remote,false
otherwise.
-
addLockInformation
public void addLockInformation(Object key, boolean contention, boolean failLock)
Adds the lock information about the key, namely if the key suffer some contention and if the keys was locked or not.- Parameters:
contention
-true
if the key was contented.failLock
-true
if the key was not locked.
-
addWriteSkewFailed
public void addWriteSkewFailed(Object key)
Adds the key to the write skew failed top-key.
-
getTopKFrom
public Map<Object,Long> getTopKFrom(StreamSummaryContainer.Stat stat)
- Returns:
- the top-key referring to the stat for all the keys.
-
getTopKFrom
public Map<Object,Long> getTopKFrom(StreamSummaryContainer.Stat stat, int topK)
- Parameters:
topK
- the topK-th first key.- Returns:
- the topK-th first key referring to the stat.
-
getTopKFromAsKeyString
public Map<String,Long> getTopKFromAsKeyString(StreamSummaryContainer.Stat stat)
Same asgetTopKFrom(org.infinispan.stats.topK.StreamSummaryContainer.Stat)
but the keys are returned in their String format.
-
getTopKFromAsKeyString
public Map<String,Long> getTopKFromAsKeyString(StreamSummaryContainer.Stat stat, int topK)
Same asgetTopKFrom(org.infinispan.stats.topK.StreamSummaryContainer.Stat, int)
but the keys are returned in their String format.
-
resetAll
public final void resetAll()
Resets all the top-key collected so far.
-
tryFlushAll
public final void tryFlushAll()
Tries to flush all the enqueue offers to be visible globally.
-
-