public void clear() { // invoke removeAll with local flag set synchronized (refList) { removeAllLocal = true; super.clear(); removeAllLocal = false; } notifyListeners(true, CacheElement.ActionRemoved,null,null); }
public boolean remove(Serializable key) { Element element = ehcache.get(key); refList.remove(key); if (element == null) return false; boolean isRemoved = ehcache.remove(key); if (isRemoved) notifyListeners(true, CacheElement.ActionRemoved,key,null); return isRemoved; }
notifyListeners(removeAllLocal, CacheElement.ActionRemoved,e.getKey(),e.getContent()); e.notifyChange(CacheElement.ActionRemoved);
public void put(CacheElement element) { EhCacheDistributedElementImpl impl = (EhCacheDistributedElementImpl) element; ehcache.put(impl.getImplElement()); refList.put(impl.getKey(), impl); notifyListeners(true, CacheElement.ActionAdded,impl.getKey(),impl.getContent()); }
public void notifyElement( Ehcache cache, boolean local,Element arg1, int action) { if (cache != this.ehcache) { System.out.println ("Cache=" + cache.getName() + " is not my cache=" + this.ehcache.getName()); return; } try { EhCacheDistributedElementImpl e = (EhCacheDistributedElementImpl) refList .get(arg1.getKey()); if (e != null) { if (action < 0) refList.remove(arg1.getKey()); else if (action == CacheElement.ActionAdded) refList.put(arg1.getKey(), new EhCacheDistributedElementImpl(arg1)); e.notifyChange(action); notifyListeners(local, action, arg1.getKey(), arg1.getObjectValue()); } else { notifyListeners(local, action, arg1.getKey(), null); } } catch (Exception e) { e.printStackTrace(); } }