Ejemplo n.º 1
0
 /*
  * Test for Issue 572
  */
 @Test(timeout = 120000)
 public void testMapstoreDeleteOnClear() throws Exception {
   Config config = getConfig();
   SimpleMapStore store = new SimpleMapStore();
   config
       .getMapConfig("testMapstoreDeleteOnClear")
       .setMapStoreConfig(new MapStoreConfig().setEnabled(true).setImplementation(store));
   HazelcastInstance hz = createHazelcastInstance(config);
   IMap<Object, Object> map = hz.getMap("testMapstoreDeleteOnClear");
   int size = 10;
   for (int i = 0; i < size; i++) {
     map.put(i, i);
   }
   assertEquals(size, map.size());
   assertEquals(size, store.store.size());
   assertEquals(size, store.loadAllKeys().size());
   map.clear();
   assertEquals(0, map.size());
   assertEquals(0, store.loadAllKeys().size());
 }
Ejemplo n.º 2
0
 @Override
 public void storeAll(Map map) {
   if (sleepStoreAllSeconds > 0) {
     try {
       Thread.sleep(sleepStoreAllSeconds * 1000);
     } catch (InterruptedException e) {
     }
   }
   for (Object o : map.keySet()) {
     latch.countDown();
     count.incrementAndGet();
   }
   super.storeAll(map);
 }
Ejemplo n.º 3
0
 public void delete(String key) {
   deleteCount.incrementAndGet();
   super.delete(key);
 }
Ejemplo n.º 4
0
 public void store(String key, Long value) {
   storeCount.incrementAndGet();
   super.store(key, value);
 }
Ejemplo n.º 5
0
 @Override
 public void store(Object key, Object value) {
   latch.countDown();
   super.store(key, value);
   count.incrementAndGet();
 }