@Test public void testMultiMapEntryListener() { MultiMap<String, String> map = Hazelcast.getMultiMap("testMultiMapEntryListener"); final CountDownLatch latchAdded = new CountDownLatch(3); final CountDownLatch latchRemoved = new CountDownLatch(1); final Set<String> expectedValues = new CopyOnWriteArraySet<String>(); expectedValues.add("hello"); expectedValues.add("world"); expectedValues.add("again"); map.addEntryListener(new EntryListener<String, String>() { public void entryAdded(EntryEvent event) { String key = (String) event.getKey(); String value = (String) event.getValue(); if ("2".equals(key)) { assertEquals("again", value); } else { assertEquals("1", key); } assertTrue(expectedValues.contains(value)); expectedValues.remove(value); latchAdded.countDown(); } public void entryRemoved(EntryEvent event) { assertEquals("1", event.getKey()); assertEquals(2, ((Collection) event.getValue()).size()); latchRemoved.countDown(); } public void entryUpdated(EntryEvent event) { throw new AssertionError("MultiMap cannot get update event!"); } public void entryEvicted(EntryEvent event) { entryRemoved(event); } }, true); map.put("1", "hello"); map.put("1", "world"); map.put("2", "again"); Collection<String> values = map.get("1"); assertEquals(2, values.size()); assertTrue(values.contains("hello")); assertTrue(values.contains("world")); assertEquals(1, map.get("2").size()); assertEquals(3, map.size()); map.remove("1"); assertEquals(1, map.size()); try { assertTrue(latchAdded.await(5, TimeUnit.SECONDS)); assertTrue(latchRemoved.await(5, TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); assertFalse(e.getMessage(), true); } }
@Deprecated public static <K, V> MultiMap<K, V> getMultiMap(String name) { return getDefaultInstance().getMultiMap(name); }
Hazelcast { @Deprecated public static <K, V> MultiMap<K, V> getMultiMap(String name) { return getDefaultInstance().getMultiMap(name); } }
Hazelcast { @Deprecated public static <K, V> MultiMap<K, V> getMultiMap(String name) { return getDefaultInstance().getMultiMap(name); } private  Hazelcast(); }
Hazelcast { @Deprecated public static <K, V> MultiMap<K, V> getMultiMap(String name) { return getDefaultInstance().getMultiMap(name); } private  Hazelcast(); @Deprecated static HazelcastInstance init(Config config); @Deprecated static HazelcastInstance getDefaultInstance(); @Deprecated static IQueue<E> getQueue(String name); @Deprecated static ITopic<E> getTopic(String name); @Deprecated static ISet<E> getSet(String name); @Deprecated static IList<E> getList(String name); @Deprecated static IMap<K, V> getMap(String name); @Deprecated static MultiMap<K, V> getMultiMap(String name); @Deprecated static ILock getLock(Object key); @Deprecated static Cluster getCluster(); @Deprecated static ExecutorService getExecutorService(); @Deprecated static ExecutorService getExecutorService(String name); @Deprecated static Transaction getTransaction(); @Deprecated static AtomicNumber getAtomicNumber(String name); @Deprecated static ICountDownLatch getCountDownLatch(String name); @Deprecated static ISemaphore getSemaphore(String name); @Deprecated static IdGenerator getIdGenerator(String name); @Deprecated static void shutdown(); static void shutdownAll(); @Deprecated static void restart(); @Deprecated static Collection<Instance> getInstances(); @Deprecated static void addInstanceListener(InstanceListener instanceListener); @Deprecated static void removeInstanceListener(InstanceListener instanceListener); static HazelcastInstance newHazelcastInstance(Config config); static HazelcastInstance newHazelcastInstance(); static HazelcastInstance newLiteMemberHazelcastInstance(); static HazelcastInstance getHazelcastInstanceByName(String instanceName); static Set<HazelcastInstance> getAllHazelcastInstances(); @Deprecated static Config getConfig(); @Deprecated static PartitionService getPartitionService(); @Deprecated static LoggingService getLoggingService(); @Deprecated static LifecycleService getLifecycleService(); static void setOutOfMemoryHandler(OutOfMemoryHandler outOfMemoryHandler); }
Hazelcast { @Deprecated public static <K, V> MultiMap<K, V> getMultiMap(String name) { return getDefaultInstance().getMultiMap(name); } private  Hazelcast(); @Deprecated static HazelcastInstance init(Config config); @Deprecated static HazelcastInstance getDefaultInstance(); @Deprecated static IQueue<E> getQueue(String name); @Deprecated static ITopic<E> getTopic(String name); @Deprecated static ISet<E> getSet(String name); @Deprecated static IList<E> getList(String name); @Deprecated static IMap<K, V> getMap(String name); @Deprecated static MultiMap<K, V> getMultiMap(String name); @Deprecated static ILock getLock(Object key); @Deprecated static Cluster getCluster(); @Deprecated static ExecutorService getExecutorService(); @Deprecated static ExecutorService getExecutorService(String name); @Deprecated static Transaction getTransaction(); @Deprecated static AtomicNumber getAtomicNumber(String name); @Deprecated static ICountDownLatch getCountDownLatch(String name); @Deprecated static ISemaphore getSemaphore(String name); @Deprecated static IdGenerator getIdGenerator(String name); @Deprecated static void shutdown(); static void shutdownAll(); @Deprecated static void restart(); @Deprecated static Collection<Instance> getInstances(); @Deprecated static void addInstanceListener(InstanceListener instanceListener); @Deprecated static void removeInstanceListener(InstanceListener instanceListener); static HazelcastInstance newHazelcastInstance(Config config); static HazelcastInstance newHazelcastInstance(); static HazelcastInstance newLiteMemberHazelcastInstance(); static HazelcastInstance getHazelcastInstanceByName(String instanceName); static Set<HazelcastInstance> getAllHazelcastInstances(); @Deprecated static Config getConfig(); @Deprecated static PartitionService getPartitionService(); @Deprecated static LoggingService getLoggingService(); @Deprecated static LifecycleService getLifecycleService(); static void setOutOfMemoryHandler(OutOfMemoryHandler outOfMemoryHandler);  }