SimpleReplicatedExoCache extends ConcurrentFIFOExoCache<K, V> { @Override public V remove(Serializable name) { V v = super.remove(name); if (v != null) { try { rpcService.executeCommandOnAllNodes(command, false, id, "r", name); } catch (Exception e) { LOG.warn("Could not remove the entry " + name + " on other cluster nodes", e); } } return v; } 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 testRemove() throws Exception { Assert.assertEquals(0, cache1.getCacheSize()); Assert.assertEquals(0, cache2.getCacheSize()); cache1.put("a", "value"); Assert.assertEquals(1, cache1.getCacheSize()); for (int i = 0; i < 5; i++) { if (cache2.getCacheSize() > 0) break; Thread.sleep(200); } Assert.assertEquals(1, cache2.getCacheSize()); Assert.assertEquals("value", cache1.remove("a")); Assert.assertEquals(0, cache1.getCacheSize()); Assert.assertNull(cache1.get("a")); 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(cache1.remove("a")); }