org.infinispan.counter.impl.strong.UnboundedStrongCounter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-clustered-counter Show documentation
Show all versions of infinispan-clustered-counter Show documentation
Infinispan Clustered Counter module
The newest version!
package org.infinispan.counter.impl.strong;
import org.infinispan.AdvancedCache;
import org.infinispan.counter.api.CounterConfiguration;
import org.infinispan.counter.impl.entries.CounterValue;
import org.infinispan.counter.impl.listener.CounterManagerNotificationManager;
/**
* An unbounded strong consistent counter.
*
* @author Pedro Ruivo
* @see AbstractStrongCounter
* @since 9.0
*/
public class UnboundedStrongCounter extends AbstractStrongCounter {
public UnboundedStrongCounter(String counterName, AdvancedCache cache,
CounterConfiguration configuration, CounterManagerNotificationManager notificationManager) {
super(counterName, cache, configuration, notificationManager);
}
@Override
protected Long handleCASResult(Object state) {
assert state instanceof Long;
return (Long) state;
}
@Override
protected long handleAddResult(CounterValue counterValue) {
return counterValue.getValue();
}
@Override
protected Long handleSetResult(Object state) {
assert state instanceof Long;
return (Long) state;
}
@Override
public String toString() {
return "UnboundedStrongCounter{" +
"counterName=" + key.getCounterName() +
'}';
}
}