Java Code Examples for org.apache.bookkeeper.stats.Counter#add()
The following examples show how to use
org.apache.bookkeeper.stats.Counter#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BroadCastStatsLogger.java From distributedlog with Apache License 2.0 | 5 votes |
@Override public Counter getCounter(final String statName) { final Counter firstCounter = first.getCounter(statName); final Counter secondCounter = second.getCounter(statName); return new Counter() { @Override public void clear() { firstCounter.clear(); secondCounter.clear(); } @Override public void inc() { firstCounter.inc(); secondCounter.inc(); } @Override public void dec() { firstCounter.dec(); secondCounter.dec(); } @Override public void add(long l) { firstCounter.add(l); secondCounter.add(l); } @Override public Long get() { // Eventually consistent. return firstCounter.get(); } }; }
Example 2
Source File: BroadCastStatsLogger.java From distributedlog with Apache License 2.0 | 5 votes |
@Override public Counter getCounter(final String statName) { final Counter firstCounter = first.getCounter(statName); final Counter secondCounter = second.getCounter(statName); return new Counter() { @Override public void clear() { firstCounter.clear(); secondCounter.clear(); } @Override public void inc() { firstCounter.inc(); secondCounter.inc(); } @Override public void dec() { firstCounter.dec(); secondCounter.dec(); } @Override public void add(long l) { firstCounter.add(l); secondCounter.add(l); } @Override public Long get() { // Eventually consistent. return firstCounter.get(); } }; }