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

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

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

Cache.applyDefaultsToElementWithoutLifespanSet介绍

暂无

代码示例

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

/**
 * Put an element in the cache, without updating statistics, or updating listeners. This is meant to be used
 * in conjunction with {@link #getQuiet}.
 * 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 element A cache Element. If Serializable it can fully participate in replication and the DiskStore. If it is
 *                <code>null</code> or the key is <code>null</code>, it is ignored as a NOOP.
 * @throws IllegalStateException    if the cache is not {@link Status#STATUS_ALIVE}
 * @throws IllegalArgumentException if the element is null
 */
public final void putQuiet(Element element) throws IllegalArgumentException, IllegalStateException,
    CacheException {
  checkStatus();
  if (disabled) {
    return;
  }
  if (element == null || element.getObjectKey() == null) {
    //nulls are ignored
    return;
  }
  applyDefaultsToElementWithoutLifespanSet(element);
  compoundStore.put(element);
}

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

private void putAllInternal(Collection<Element> elements, boolean doNotNotifyCacheReplicators) {
  putAllObserver.begin();
  checkStatus();
  if (disabled || elements.isEmpty()) {
    putAllObserver.end(PutAllOutcome.IGNORED);
    return;
  }
  backOffIfDiskSpoolFull();
  compoundStore.putAll(elements);
  for (Element element : elements) {
    element.resetAccessStatistics();
    applyDefaultsToElementWithoutLifespanSet(element);
    notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false);
  }
  putAllObserver.end(PutAllOutcome.COMPLETED);
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

applyDefaultsToElementWithoutLifespanSet(element);

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

private void putAllInternal(Collection<Element> elements, boolean doNotNotifyCacheReplicators) {
  checkStatus();
  if (disabled || elements.isEmpty()) {
    return;
  }
  backOffIfDiskSpoolFull();
  compoundStore.putAll(elements);
  for (Element element : elements) {
    element.resetAccessStatistics();
    applyDefaultsToElementWithoutLifespanSet(element);
    notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false);
  }
}

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

/**
 * Put an element in the cache, without updating statistics, or updating listeners. This is meant to be used
 * in conjunction with {@link #getQuiet}.
 * 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 element A cache Element. If Serializable it can fully participate in replication and the DiskStore. If it is
 *                <code>null</code> or the key is <code>null</code>, it is ignored as a NOOP.
 * @throws IllegalStateException    if the cache is not {@link Status#STATUS_ALIVE}
 * @throws IllegalArgumentException if the element is null
 */
public final void putQuiet(Element element) throws IllegalArgumentException, IllegalStateException,
    CacheException {
  checkStatus();
  if (disabled) {
    return;
  }
  if (element == null || element.getObjectKey() == null) {
    //nulls are ignored
    return;
  }
  applyDefaultsToElementWithoutLifespanSet(element);
  compoundStore.put(element);
}

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

/**
 * Put an element in the cache, without updating statistics, or updating listeners. This is meant to be used
 * in conjunction with {@link #getQuiet}.
 * 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 element A cache Element. If Serializable it can fully participate in replication and the DiskStore. If it is
 *                <code>null</code> or the key is <code>null</code>, it is ignored as a NOOP.
 * @throws IllegalStateException    if the cache is not {@link Status#STATUS_ALIVE}
 * @throws IllegalArgumentException if the element is null
 */
public final void putQuiet(Element element) throws IllegalArgumentException, IllegalStateException,
    CacheException {
  checkStatus();
  if (disabled) {
    return;
  }
  if (element == null || element.getObjectKey() == null) {
    //nulls are ignored
    return;
  }
  applyDefaultsToElementWithoutLifespanSet(element);
  compoundStore.put(element);
}

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

/**
 * Put an element in the cache, without updating statistics, or updating listeners. This is meant to be used
 * in conjunction with {@link #getQuiet}.
 * 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 element A cache Element. If Serializable it can fully participate in replication and the DiskStore. If it is
 *                <code>null</code> or the key is <code>null</code>, it is ignored as a NOOP.
 * @throws IllegalStateException    if the cache is not {@link Status#STATUS_ALIVE}
 * @throws IllegalArgumentException if the element is null
 */
public final void putQuiet(Element element) throws IllegalArgumentException, IllegalStateException,
    CacheException {
  checkStatus();
  if (disabled) {
    return;
  }
  if (element == null || element.getObjectKey() == null) {
    //nulls are ignored
    return;
  }
  applyDefaultsToElementWithoutLifespanSet(element);
  compoundStore.put(element);
}

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

private void putAllInternal(Collection<Element> elements, boolean doNotNotifyCacheReplicators) {
  putAllObserver.begin();
  checkStatus();
  if (disabled || elements.isEmpty()) {
    putAllObserver.end(PutAllOutcome.IGNORED);
    return;
  }
  backOffIfDiskSpoolFull();
  compoundStore.putAll(elements);
  for (Element element : elements) {
    element.resetAccessStatistics();
    applyDefaultsToElementWithoutLifespanSet(element);
    notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false);
  }
  putAllObserver.end(PutAllOutcome.COMPLETED);
}

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

private void putAllInternal(Collection<Element> elements, boolean doNotNotifyCacheReplicators) {
  putAllObserver.begin();
  checkStatus();
  if (disabled || elements.isEmpty()) {
    putAllObserver.end(PutAllOutcome.IGNORED);
    return;
  }
  backOffIfDiskSpoolFull();
  compoundStore.putAll(elements);
  for (Element element : elements) {
    element.resetAccessStatistics();
    applyDefaultsToElementWithoutLifespanSet(element);
    notifyPutInternalListeners(element, doNotNotifyCacheReplicators, false);
  }
  putAllObserver.end(PutAllOutcome.COMPLETED);
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

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

/**
 * {@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;
}

相关文章

Cache类方法