/** * Gets an element from the cache, without updating Element statistics. Cache statistics are * still updated. Listeners are not called. * * @param key a serializable value * @return the element, or null, if it does not exist. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} * @see #isExpired */ public final Element getQuiet(Serializable key) throws IllegalStateException, CacheException { return getQuiet((Object) key); }
for (Iterator iter = allKeyList.iterator(); iter.hasNext();) { Object key = iter.next(); Element element = getQuiet(key); if (element != null) { nonExpiredKeys.add(key);
/** * {@inheritDoc} */ public boolean removeElement(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return false; } removeElementObserver.begin(); // this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); Element result = compoundStore.removeElement(element, elementValueComparator); removeElementObserver.end(result==null?RemoveElementOutcome.FAILURE :RemoveElementOutcome.SUCCESS); // FIXME shouldn't this be done only if result != null notifyRemoveInternalListeners(element.getObjectKey(), false, true, false, result); return result != null; }
/** * Gets an element from the cache, without updating Element statistics. Cache statistics are * still updated. Listeners are not called. * * @param key a serializable value * @return the element, or null, if it does not exist. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} * @see #isExpired */ public final Element getQuiet(Serializable key) throws IllegalStateException, CacheException { return getQuiet((Object) key); }
/** * Gets an element from the cache, without updating Element statistics. Cache statistics are * still updated. Listeners are not called. * <p/> * * @param key a serializable value * @return the element, or null, if it does not exist. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} * @see #isExpired */ public final Element getQuiet(Serializable key) throws IllegalStateException, CacheException { return getQuiet((Object) key); }
@Override public boolean contains(NotificationId notificationId) { return this.cache.getQuiet(notificationId) != null; }
/** * Gets an element from the cache, without updating Element statistics. Cache statistics are * still updated. Listeners are not called. * <p/> * * @param key a serializable value * @return the element, or null, if it does not exist. * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE} * @see #isExpired */ public final Element getQuiet(Serializable key) throws IllegalStateException, CacheException { return getQuiet((Object) key); }
/** * {@inheritDoc} */ public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { checkStatus(); checkCASOperationSupported(); if (old.getObjectKey() == null || element.getObjectKey() == null) { throw new NullPointerException(); } if (!old.getObjectKey().equals(element.getObjectKey())) { throw new IllegalArgumentException("The keys for the element arguments to replace must be equal"); } if (disabled) { return false; } replace2Observer.begin(); getQuiet(old.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); boolean result = compoundStore.replace(old, element, elementValueComparator); if (result) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); replace2Observer.end(CacheOperationOutcomes.ReplaceTwoArgOutcome.SUCCESS); } else { replace2Observer.end(CacheOperationOutcomes.ReplaceTwoArgOutcome.FAILURE); } return result; }
/** * {@inheritDoc} */ public Element putIfAbsent(Element element, boolean doNotNotifyCacheReplicators) throws NullPointerException { checkStatus(); checkCASOperationSupported(doNotNotifyCacheReplicators); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } putIfAbsentObserver.begin(); //this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); element.updateUpdateStatistics(); Element result = compoundStore.putIfAbsent(element); if (result == null) { notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false); putIfAbsentObserver.end(PutIfAbsentOutcome.SUCCESS); } else { putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); } return result; }
/** * {@inheritDoc} */ public Element replace(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } replace1Observer.begin(); getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); Element result = compoundStore.replace(element); if (result != null) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS); } else { replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE); } return result; }
/** * {@inheritDoc} */ public boolean removeElement(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return false; } // this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); Element result = compoundStore.removeElement(element, elementValueComparator); // FIXME shouldn't this be done only if result != null notifyRemoveInternalListeners(element.getObjectKey(), false, true, false, result); return result != null; }
/** * {@inheritDoc} */ public boolean removeElement(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return false; } removeElementObserver.begin(); // this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); Element result = compoundStore.removeElement(element, elementValueComparator); removeElementObserver.end(result==null?RemoveElementOutcome.FAILURE :RemoveElementOutcome.SUCCESS); // FIXME shouldn't this be done only if result != null notifyRemoveInternalListeners(element.getObjectKey(), false, true, false, result); return result != null; }
/** * {@inheritDoc} */ public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { checkStatus(); checkCASOperationSupported(); if (old.getObjectKey() == null || element.getObjectKey() == null) { throw new NullPointerException(); } if (!old.getObjectKey().equals(element.getObjectKey())) { throw new IllegalArgumentException("The keys for the element arguments to replace must be equal"); } if (disabled) { return false; } getQuiet(old.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); boolean result = compoundStore.replace(old, element, elementValueComparator); if (result) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); } return result; }
/** * {@inheritDoc} */ public boolean removeElement(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return false; } removeElementObserver.begin(); // this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); Element result = compoundStore.removeElement(element, elementValueComparator); removeElementObserver.end(result==null?RemoveElementOutcome.FAILURE :RemoveElementOutcome.SUCCESS); // FIXME shouldn't this be done only if result != null notifyRemoveInternalListeners(element.getObjectKey(), false, true, false, result); return result != null; }
/** * {@inheritDoc} */ public Element replace(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); Element result = compoundStore.replace(element); if (result != null) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); } return result; }
/** * {@inheritDoc} */ public Element putIfAbsent(Element element, boolean doNotNotifyCacheReplicators) throws NullPointerException { checkStatus(); checkCASOperationSupported(doNotNotifyCacheReplicators); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } //this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); element.updateUpdateStatistics(); Element result = compoundStore.putIfAbsent(element); if (result == null) { notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false); } return result; }
/** * {@inheritDoc} */ public Element replace(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } replace1Observer.begin(); getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); Element result = compoundStore.replace(element); if (result != null) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS); } else { replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE); } return result; }
/** * {@inheritDoc} */ public Element replace(Element element) throws NullPointerException { checkStatus(); checkCASOperationSupported(); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } replace1Observer.begin(); getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); Element result = compoundStore.replace(element); if (result != null) { element.updateUpdateStatistics(); notifyPutInternalListeners(element, false, true); replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS); } else { replace1Observer.end(CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE); } return result; }
/** * {@inheritDoc} */ public Element putIfAbsent(Element element, boolean doNotNotifyCacheReplicators) throws NullPointerException { checkStatus(); checkCASOperationSupported(doNotNotifyCacheReplicators); if (element.getObjectKey() == null) { throw new NullPointerException(); } if (disabled) { return null; } putIfAbsentObserver.begin(); //this guard currently ensures reasonable behavior on expiring elements getQuiet(element.getObjectKey()); element.resetAccessStatistics(); applyDefaultsToElementWithoutLifespanSet(element); backOffIfDiskSpoolFull(); element.updateUpdateStatistics(); Element result = compoundStore.putIfAbsent(element); if (result == null) { notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false); putIfAbsentObserver.end(PutIfAbsentOutcome.SUCCESS); } else { putIfAbsentObserver.end(PutIfAbsentOutcome.FAILURE); } return result; }