hazelcast/src/test/java/com/hazelcast/map/mapstore/MapStoreTest.java
@Test
    @Category(NightlyTest.class)
    public void testWriteBehindWriteRemoveOrderOfSameKey() throws Exception {
        final String mapName = randomMapName("_testWriteBehindWriteRemoveOrderOfSameKey_");
        final int iterationCount = 5;
        final int delaySeconds = 1;
        final int putOps = 3;
        final int removeOps = 2;
        final int expectedStoreSizeEventually = 1;
        final RecordingMapStore store = new RecordingMapStore(iterationCount * putOps, iterationCount * removeOps);
        final Config config = newConfig(store, delaySeconds);
        final HazelcastInstance node = createHazelcastInstance(config);
        final IMap<Object, Object> map = node.getMap(mapName);
        for (int i = 0; i < iterationCount; i++) {
            String key = "key";
            String value = "value" + i;
            map.put(key, value);
            sleepMillis(1000);
            map.remove(key);
            sleepMillis(1000);
            map.put(key, value);
            sleepMillis(1000);
            map.remove(key);
            sleepMillis(1000);
            map.put(key, value);
            sleepMillis(1000);
        }

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(expectedStoreSizeEventually, store.getStore().size());
            }
        });
    }
/**
     * At least sleep 1 second so entries can fall different time slices in
     * {@link com.hazelcast.util.scheduler.SecondsBasedEntryTaskScheduler}
     */
At least sleep 1 second so entries can fall different time slices in
com.hazelcast.util.scheduler.SecondsBasedEntryTaskScheduler
At least sleep 1 second so entries can fall different time slices in com . hazelcast . util . scheduler . SecondsBasedEntryTaskScheduler
@Test
    @Category(NightlyTest.class)
    public void testWriteBehindWriteRemoveOrderOfSameKey() throws Exception {
        final String mapName = randomMapName("_testWriteBehindWriteRemoveOrderOfSameKey_");
        final int iterationCount = 5;
        final int delaySeconds = 1;
        final int putOps = 3;
        final int removeOps = 2;
        final int expectedStoreSizeEventually = 1;
        final RecordingMapStore store = new RecordingMapStore(iterationCount * putOps, iterationCount * removeOps);
        final Config config = newConfig(store, delaySeconds);
        final HazelcastInstance node = createHazelcastInstance(config);
        final IMap<Object, Object> map = node.getMap(mapName);
        for (int i = 0; i < iterationCount; i++) {
            String key = "key";
            String value = "value" + i;
            map.put(key, value);
            sleepMillis(1000);
            map.remove(key);
            sleepMillis(1000);
            map.put(key, value);
            sleepMillis(1000);
            map.remove(key);
            sleepMillis(1000);
            map.put(key, value);
            sleepMillis(1000);
        }
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(expectedStoreSizeEventually, store.getStore().size());
            }
        });
    }
@ Test @ Category ( NightlyTest . class ) public void testWriteBehindWriteRemoveOrderOfSameKey ( ) throws Exception { final String mapName = randomMapName ( "_testWriteBehindWriteRemoveOrderOfSameKey_" ) ; final int iterationCount = 5 ; final int delaySeconds = 1 ; final int putOps = 3 ; final int removeOps = 2 ; final int expectedStoreSizeEventually = 1 ; final RecordingMapStore store = new RecordingMapStore ( iterationCount * putOps , iterationCount * removeOps ) ; final Config config = newConfig ( store , delaySeconds ) ; final HazelcastInstance node = createHazelcastInstance ( config ) ; final IMap < Object , Object > map = node . getMap ( mapName ) ; for ( int i = 0 ; i < iterationCount ; i ++ ) { String key = "key" ; String value = "value" + i ; map . put ( key , value ) ; sleepMillis ( 1000 ) ; map . remove ( key ) ; sleepMillis ( 1000 ) ; map . put ( key , value ) ; sleepMillis ( 1000 ) ; map . remove ( key ) ; sleepMillis ( 1000 ) ; map . put ( key , value ) ; sleepMillis ( 1000 ) ; } assertTrueEventually ( new AssertTask ( ) { @ Override public void run ( ) throws Exception { assertEquals ( expectedStoreSizeEventually , store . getStore ( ) . size ( ) ) ; } } ) ; }
At least sleep 1 second so entries can fall different time slices in
 {@link com.hazelcast.util.scheduler.SecondsBasedEntryTaskScheduler}
At least sleep 1 second so entries can fall different time slices in { @link com . hazelcast . util . scheduler . SecondsBasedEntryTaskScheduler }