use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testPutAsync.
@Test
public void testPutAsync() throws Exception {
IMap<Integer, Integer> map = getMap();
for (int i = 0; i < 100; i++) {
map.putAsync(i, i);
}
final LocalMapStats localMapStats = map.getLocalMapStats();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(100, localMapStats.getPutOperationCount());
}
});
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testGetAndHitsGenerated.
@Test
public void testGetAndHitsGenerated() throws Exception {
IMap<Integer, Integer> map = getMap();
for (int i = 0; i < 100; i++) {
map.put(i, i);
map.get(i);
}
LocalMapStats localMapStats = map.getLocalMapStats();
assertEquals(100, localMapStats.getGetOperationCount());
assertEquals(100, localMapStats.getHits());
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testGetAllGenerated.
@Test
public void testGetAllGenerated() throws Exception {
IMap<Integer, Integer> map = getMap();
for (int i = 0; i < 200; i++) {
map.put(i, i);
}
for (int i = 0; i < 100; i++) {
Set<Integer> keys = new HashSet<Integer>();
keys.add(i);
keys.add(100 + i);
map.getAll(keys);
}
LocalMapStats localMapStats = map.getLocalMapStats();
assertEquals(200, localMapStats.getGetOperationCount());
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testRemoveAsync.
@Test
public void testRemoveAsync() throws Exception {
IMap<Integer, Integer> map = getMap();
for (int i = 0; i < 100; i++) {
map.put(i, i);
map.removeAsync(i);
}
final LocalMapStats localMapStats = map.getLocalMapStats();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(100, localMapStats.getRemoveOperationCount());
}
});
}
use of com.hazelcast.monitor.LocalMapStats in project hazelcast by hazelcast.
the class LocalMapStatsTest method testHitsGenerated_updatedConcurrently.
@Test
public void testHitsGenerated_updatedConcurrently() throws Exception {
final IMap<Integer, Integer> map = getMap();
final int actionCount = 100;
for (int i = 0; i < actionCount; i++) {
map.put(i, i);
map.get(i);
}
final LocalMapStats localMapStats = map.getLocalMapStats();
final long initialHits = localMapStats.getHits();
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < actionCount; i++) {
map.get(i);
}
// causes the local stats object to update
map.getLocalMapStats();
}
}).start();
assertEquals(actionCount, initialHits);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(actionCount * 2, localMapStats.getHits());
}
});
}
Aggregations