Class WeakCounterImpl

java.lang.Object
org.infinispan.counter.impl.weak.WeakCounterImpl
All Implemented Interfaces:
WeakCounter, CounterEventGenerator, TopologyChangeListener, InternalCounterAdmin

public class WeakCounterImpl extends Object implements WeakCounter, CounterEventGenerator, TopologyChangeListener, InternalCounterAdmin
A weak consistent counter implementation.

Implementation: The counter is split in multiple keys and they are stored in the cache.

Write: A write operation will pick a key to update. If the node is a primary owner of one of the key, that key is chosen based on thread-id. This will take advantage of faster write operations. If the node is not a primary owner, one of the key in key set is chosen.

Read: A read operation needs to read all the key set (including the remote keys). This is slower than atomic counter.

Weak Read: A snapshot of all the keys values is kept locally and they are updated via cluster listeners.

Reset: The reset operation is not atomic and intermediate results may be observed.

Since:
9.0
Author:
Pedro Ruivo