SimpleReplicatedExoCache extends ConcurrentFIFOExoCache<K, V> { @Override public void clearCache() { super.clearCache(); try { rpcService.executeCommandOnAllNodes(command, false, id, "c"); } catch (Exception e) { LOG.warn("Could not clear the cache on other cluster nodes", e); } } SimpleReplicatedExoCache();   SimpleReplicatedExoCache(ExoContainerContext ctx, RPCService rpcService); @Override void setName(String s); @Override V remove(Serializable name); @Override void clearCache(); @Override void put(K name, V obj); @Override void putMap(Map<? extends K, ? extends V> objs);  }
@Test public void testClearCache() throws Exception { Assert.assertEquals(0, cache1.getCacheSize()); Assert.assertEquals(0, cache2.getCacheSize()); cache1.put("a", "value"); cache1.put("b", "value"); cache1.put("c", "value"); Assert.assertEquals(3, cache1.getCacheSize()); for (int i = 0; i < 5; i++) { if (cache2.getCacheSize() == 3) break; Thread.sleep(200); } Assert.assertEquals(3, cache2.getCacheSize()); cache1.clearCache(); Assert.assertEquals(0, cache1.getCacheSize()); Assert.assertNull(cache1.get("a")); Assert.assertNull(cache1.get("b")); Assert.assertNull(cache1.get("c")); for (int i = 0; i < 5; i++) { if (cache2.getCacheSize() == 0) break; Thread.sleep(200); } Assert.assertEquals(0, cache2.getCacheSize()); Assert.assertNull(cache2.get("a")); Assert.assertNull(cache2.get("b")); Assert.assertNull(cache2.get("c")); }