Search in sources :

Example 31 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class LocalMultiMapStatsTest method testOtherOperationCount_keySet.

@Test
public void testOtherOperationCount_keySet() {
    MultiMap map = getMultiMap();
    for (int i = 0; i < OPERATION_COUNT; i++) {
        map.keySet();
    }
    LocalMapStats stats = getMultiMapStats();
    assertEquals(OPERATION_COUNT, stats.getOtherOperationCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 32 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class LocalMultiMapStatsTest method testOtherOperationCount_values.

@Test
public void testOtherOperationCount_values() {
    MultiMap map = getMultiMap();
    for (int i = 0; i < OPERATION_COUNT; i++) {
        map.values();
    }
    LocalMapStats stats = getMultiMapStats();
    assertEquals(OPERATION_COUNT, stats.getOtherOperationCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 33 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class LocalMultiMapStatsTest method testOtherOperationCount_localKeySet.

@Test
public void testOtherOperationCount_localKeySet() {
    MultiMap map = getMultiMap();
    for (int i = 0; i < OPERATION_COUNT; i++) {
        map.localKeySet();
    }
    LocalMapStats stats = getMultiMapStats();
    assertEquals(OPERATION_COUNT, stats.getOtherOperationCount());
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 34 with LocalMapStats

use of com.hazelcast.map.LocalMapStats in project hazelcast by hazelcast.

the class LocalMultiMapStatsTest method testLastAccessTime_updatedConcurrently.

@Test
public void testLastAccessTime_updatedConcurrently() {
    final long startTime = Clock.currentTimeMillis();
    final MultiMap<String, String> map = getMultiMap();
    final String key = "key";
    map.put(key, "value");
    map.put(key, "value");
    final LocalMapStats localMapStats = getMultiMapStats();
    final long lastUpdateTime = localMapStats.getLastUpdateTime();
    new Thread(() -> {
        sleepAtLeastMillis(1);
        map.put(key, "value2");
        // causes the local stats object to update
        getMultiMapStats();
    }).start();
    assertTrue(lastUpdateTime >= startTime);
    assertTrueEventually(() -> assertTrue(localMapStats.getLastUpdateTime() > lastUpdateTime));
}
Also used : LocalMapStats(com.hazelcast.map.LocalMapStats) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

LocalMapStats (com.hazelcast.map.LocalMapStats)34 QuickTest (com.hazelcast.test.annotation.QuickTest)29 Test (org.junit.Test)29 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)28 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 MapConfig (com.hazelcast.config.MapConfig)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 IMap (com.hazelcast.map.IMap)3 Config (com.hazelcast.config.Config)2 LocalIndexStats (com.hazelcast.query.LocalIndexStats)2 Map (java.util.Map)2 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 DistributedObject (com.hazelcast.core.DistributedObject)1 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)1 LocalIndexStatsImpl (com.hazelcast.internal.monitor.impl.LocalIndexStatsImpl)1 LocalMapStatsImpl (com.hazelcast.internal.monitor.impl.LocalMapStatsImpl)1 PerIndexStats (com.hazelcast.internal.monitor.impl.PerIndexStats)1 StatisticsAwareService (com.hazelcast.internal.services.StatisticsAwareService)1 BasicMapTest (com.hazelcast.map.BasicMapTest)1