use of com.hazelcast.map.impl.mapstore.writebehind.MapStoreWithCounter in project hazelcast by hazelcast.
the class ClientWriteBehindFlushTest method setUp.
@Before
public void setUp() throws Exception {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
MapStoreWithCounter mapStore = new MapStoreWithCounter<Integer, String>();
mapStoreConfig.setImplementation(mapStore).setWriteDelaySeconds(3000);
Config config = getConfig();
config.getMapConfig(MAP_NAME).setMapStoreConfig(mapStoreConfig);
TestHazelcastFactory hazelcastFactory = new TestHazelcastFactory();
member1 = hazelcastFactory.newHazelcastInstance(config);
member2 = hazelcastFactory.newHazelcastInstance(config);
member3 = hazelcastFactory.newHazelcastInstance(config);
client = hazelcastFactory.newHazelcastClient();
}
use of com.hazelcast.map.impl.mapstore.writebehind.MapStoreWithCounter in project hazelcast by hazelcast.
the class MapStoreTest method testEntryProcessor_calls_load_only_one_time_per_key.
@Test
public void testEntryProcessor_calls_load_only_one_time_per_key() throws Exception {
Config config = getConfig();
// configure map with one backup and dummy map store
MapConfig mapConfig = config.getMapConfig("default");
MapStoreConfig mapStoreConfig = new MapStoreConfig();
MapStoreWithCounter mapStore = new MapStoreWithCounter();
mapStoreConfig.setImplementation(mapStore);
mapConfig.setMapStoreConfig(mapStoreConfig);
HazelcastInstance member = createHazelcastInstance(config);
IMap<Integer, Integer> map = member.getMap("default");
map.executeOnKey(1, new AbstractEntryProcessor<Integer, Integer>(false) {
@Override
public Object process(Map.Entry<Integer, Integer> entry) {
entry.setValue(2);
return null;
}
});
assertEquals(1, mapStore.getLoadCount());
}
Aggregations