use of com.hazelcast.monitor.LocalReplicatedMapStats in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testPutOperationCount.
@Test
public void testPutOperationCount() throws Exception {
ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
int count = 100;
for (int i = 0; i < count; i++) {
replicatedMap.put(i, i);
}
LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
assertEquals(count, stats.getPutOperationCount());
}
use of com.hazelcast.monitor.LocalReplicatedMapStats in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testPutAndHitsGenerated.
@Test
public void testPutAndHitsGenerated() throws Exception {
ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
for (int i = 0; i < 100; i++) {
replicatedMap.put(i, i);
replicatedMap.get(i);
}
LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
assertEquals(100, stats.getHits());
}
use of com.hazelcast.monitor.LocalReplicatedMapStats in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testLastAccessTime_updatedConcurrently.
@Test
public void testLastAccessTime_updatedConcurrently() throws InterruptedException {
final long startTime = Clock.currentTimeMillis();
final ReplicatedMap<String, String> map = getReplicatedMap();
final String key = "key";
map.put(key, "value");
map.get(key);
final LocalReplicatedMapStats stats = map.getReplicatedMapStats();
final long lastAccessTime = stats.getLastAccessTime();
new Thread(new Runnable() {
@Override
public void run() {
sleepAtLeastMillis(1);
map.get(key);
// causes the local stats object to update
map.getReplicatedMapStats();
}
}).start();
assertTrue(lastAccessTime >= startTime);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertTrue(stats.getLastAccessTime() >= lastAccessTime);
}
});
}
use of com.hazelcast.monitor.LocalReplicatedMapStats in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testRemoveOperationCount.
@Test
public void testRemoveOperationCount() throws Exception {
ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
int count = 100;
for (int i = 0; i < count; i++) {
replicatedMap.put(i, i);
replicatedMap.remove(i);
}
LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
assertEquals(count, stats.getRemoveOperationCount());
}
use of com.hazelcast.monitor.LocalReplicatedMapStats in project hazelcast by hazelcast.
the class ReplicatedMapStatsTest method testHitsGenerated.
@Test
public void testHitsGenerated() throws Exception {
ReplicatedMap<Integer, Integer> replicatedMap = getReplicatedMap();
for (int i = 0; i < 100; i++) {
replicatedMap.put(i, i);
replicatedMap.get(i);
}
LocalReplicatedMapStats stats = replicatedMap.getReplicatedMapStats();
assertEquals(100, stats.getHits());
}
Aggregations