net.sf.ehcache.Cache.removeInternal()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(13.0k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中net.sf.ehcache.Cache.removeInternal()方法的一些代码示例,展示了Cache.removeInternal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.removeInternal()方法的具体详情如下:
包路径:net.sf.ehcache.Cache
类名称:Cache
方法名:removeInternal

Cache.removeInternal介绍

[英]Removes or expires an Element from the Cache after an attempt to get it determined that it should be expired. This also removes it from any stores it may be in.

Also notifies the CacheEventListener after the element has expired.

Synchronization is handled within the method.

If a remove was called, listeners are notified, regardless of whether the element existed or not. This allows distributed cache listeners to remove elements from a cluster regardless of whether they existed locally.

Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception should be caught in those circumstances.
[中]

代码示例

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p>
 * Listeners are not called.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean removeQuiet(Serializable key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p>
 * Listeners are not called.
 * <p>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 * @since 1.2
 */
public final boolean removeQuiet(Object key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public boolean removeWithWriter(Object key) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, false, true) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Removes an {@link Element} from the Cache. This also removes it from any
 * stores it may be in.
 * <p>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element
 * with the key actually existed.
 * <p>
 * Synchronization is handled within the method.
 *
 * @param key                         the element key to operate on
 * @param doNotNotifyCacheReplicators whether the remove is coming from a doNotNotifyCacheReplicators cache peer, in which case this remove should not initiate a
 *                                    further notification to doNotNotifyCacheReplicators cache peers
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, doNotNotifyCacheReplicators, false) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Removes an {@link Element} from the Cache and returns it. This also removes it from any
 * stores it may be in.
 * <p>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element with the key actually existed.
 * <p>
 * Synchronization is handled within the method.
 * <p>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 *
 * @param key the element key to operate on
 * @return element the removed element associated with the key, null if no mapping exists
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final Element removeAndReturnElement(Object key) throws IllegalStateException {
  removeObserver.begin();
  try {
    return removeInternal(key, false, true, false, false);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: net.sf.ehcache/ehcache

removeInternal(key, true, notifyListeners, false, false);
} finally {
  syncForKey.unlock(LockType.WRITE);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * {@inheritDoc}
 */
public boolean removeWithWriter(Object key) throws IllegalStateException {
  return (removeInternal(key, false, true, false, true) != null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p/>
 * Listeners are not called.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean removeQuiet(Serializable key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p>
 * Listeners are not called.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean removeQuiet(Serializable key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p/>
 * Listeners are not called.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean removeQuiet(Serializable key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p/>
 * Listeners are not called.
 * <p/>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 * @since 1.2
 */
public final boolean removeQuiet(Object key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache and returns it. This also removes it from any
 * stores it may be in.
 * <p/>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element with the key actually existed.
 * <p/>
 * Synchronization is handled within the method.
 * <p/>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 * <p/>
 *
 * @param key the element key to operate on
 * @return element the removed element associated with the key, null if no mapping exists
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final Element removeAndReturnElement(Object key) throws IllegalStateException {
  return removeInternal(key, false, true, false, false);
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p>
 * Listeners are not called.
 * <p>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 * @since 1.2
 */
public final boolean removeQuiet(Object key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache, without notifying listeners. This also removes it from any
 * stores it may be in.
 * <p/>
 * Listeners are not called.
 * <p/>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 *
 * @param key the element key to operate on
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 * @since 1.2
 */
public final boolean removeQuiet(Object key) throws IllegalStateException {
  return (removeInternal(key, false, false, false, false) != null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache. This also removes it from any
 * stores it may be in.
 * <p/>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element
 * with the key actually existed.
 * <p/>
 * Synchronization is handled within the method.
 *
 * @param key                         the element key to operate on
 * @param doNotNotifyCacheReplicators whether the remove is coming from a doNotNotifyCacheReplicators cache peer, in which case this remove should not initiate a
 *                                    further notification to doNotNotifyCacheReplicators cache peers
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  return (removeInternal(key, false, true, doNotNotifyCacheReplicators, false) != null);
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * {@inheritDoc}
 */
public boolean removeWithWriter(Object key) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, false, true) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * {@inheritDoc}
 */
public boolean removeWithWriter(Object key) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, false, true) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * Removes an {@link Element} from the Cache. This also removes it from any
 * stores it may be in.
 * <p>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element
 * with the key actually existed.
 * <p>
 * Synchronization is handled within the method.
 *
 * @param key                         the element key to operate on
 * @param doNotNotifyCacheReplicators whether the remove is coming from a doNotNotifyCacheReplicators cache peer, in which case this remove should not initiate a
 *                                    further notification to doNotNotifyCacheReplicators cache peers
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, doNotNotifyCacheReplicators, false) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache. This also removes it from any
 * stores it may be in.
 * <p/>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element
 * with the key actually existed.
 * <p/>
 * Synchronization is handled within the method.
 *
 * @param key                         the element key to operate on
 * @param doNotNotifyCacheReplicators whether the remove is coming from a doNotNotifyCacheReplicators cache peer, in which case this remove should not initiate a
 *                                    further notification to doNotNotifyCacheReplicators cache peers
 * @return true if the element was removed, false if it was not found in the cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  removeObserver.begin();
  try {
    return (removeInternal(key, false, true, doNotNotifyCacheReplicators, false) != null);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * Removes an {@link Element} from the Cache and returns it. This also removes it from any
 * stores it may be in.
 * <p/>
 * Also notifies the CacheEventListener after the element was removed, but only if an Element with the key actually existed.
 * <p/>
 * Synchronization is handled within the method.
 * <p/>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception
 * should be caught in those circumstances.
 * <p/>
 *
 * @param key the element key to operate on
 * @return element the removed element associated with the key, null if no mapping exists
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final Element removeAndReturnElement(Object key) throws IllegalStateException {
  removeObserver.begin();
  try {
    return removeInternal(key, false, true, false, false);
  } finally {
    removeObserver.end(RemoveOutcome.SUCCESS);
  }
}

相关文章

微信公众号

最新文章

更多

Cache类方法