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

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

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

Cache.checkStatus介绍

暂无

代码示例

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

/**
 * {@inheritDoc}
 * <p>
 * Note, the {@link #getSize} method will have the same value as the size
 * reported by Statistics for the statistics accuracy of
 */
public StatisticsGateway getStatistics() throws IllegalStateException {
  checkStatus();
  return statistics;
}

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

/**
 * Gets the internal Store.
 *
 * @return the Store referenced by this cache
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
final Store getStore() throws IllegalStateException {
  checkStatus();
  return compoundStore;
}

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

/**
 * {@inheritDoc}
 */
public Object getInternalContext() {
  checkStatus();
  return compoundStore.getInternalContext();
}

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

/**
 * {@inheritDoc}
 */
public void recalculateSize(Object key) {
  checkStatus();
  this.compoundStore.recalculateSize(key);
}

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

/**
 * {@inheritDoc}
 */
public boolean isClusterBulkLoadEnabled() throws UnsupportedOperationException, TerracottaNotRunningException {
  checkStatus();
  return !compoundStore.isClusterCoherent();
}

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

/**
 * {@inheritDoc}
 */
public boolean hasAbortedSizeOf() {
  checkStatus();
  return compoundStore.hasAbortedSizeOf();
}

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

/**
 * Causes all elements stored in the Cache to be synchronously checked for expiry, and if expired, evicted.
 */
public void evictExpiredElements() {
  checkStatus();
  compoundStore.expireElements();
}

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

/**
 * Gets the lock for a given key
 *
 * @param key the key we want the lock for
 * @return the lock object for the passed in key
 */
protected Sync getLockForKey(final Object key) {
  checkStatus();
  return lockProvider.getSyncForKey(key);
}

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

/**
 * @return the current in-memory eviction policy. This may not be the configured policy, if it has been
 *         dynamically set.
 */
public Policy getMemoryStoreEvictionPolicy() {
  checkStatus();
  return compoundStore.getInMemoryEvictionPolicy();
}

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

/**
 * @return set of all search attributes in effect at the time of calling this method 
 *  @throws CacheException in case of error
 */
public Set<Attribute> getSearchAttributes() throws CacheException {
  checkStatus();
  return compoundStore.getSearchAttributes();
}

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

/**
 * {@inheritDoc}
 */
public boolean isNodeBulkLoadEnabled() throws UnsupportedOperationException, TerracottaNotRunningException {
  checkStatus();
  return !compoundStore.isNodeCoherent();
}

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

/**
 * Whether an Element is stored in the cache in Memory, indicating a very low cost of retrieval.
 * <p>
 * Since no assertions are made about the state of the Element it is possible that the
 * Element is expired, but this method still returns true.
 *
 * @return true if an element matching the key is found in memory
 * @since 1.2
 */
public final boolean isElementInMemory(Object key) {
  checkStatus();
  return compoundStore.containsKeyInMemory(key);
}

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

/**
 * Whether an Element is stored in the cache in off-heap memory, indicating an intermediate cost of retrieval.
 * <p>
 * Since no assertions are made about the state of the Element it is possible that the
 * Element is expired, but this method still returns true.
 *
 * @param key key to look for
 * @return true if an element matching the key is found in off-heap
 * @since 2.3
 */
public final boolean isElementOffHeap(Object key) {
  checkStatus();
  return compoundStore.containsKeyOffHeap(key);
}

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

/**
 * Gets the size of the off-heap store for this cache.
 *
 * @return the size of the off-heap store in bytes
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
@Deprecated public final long calculateOffHeapSize() throws IllegalStateException, CacheException {
  checkStatus();
  return getStatistics().getLocalOffHeapSizeInBytes();
}

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

/**
 * Gets the size of the on-disk store for this cache
 *
 * @return the size of the on-disk store in bytes
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
@Deprecated public final long calculateOnDiskSize() throws IllegalStateException, CacheException {
  checkStatus();
  return getStatistics().getLocalDiskSizeInBytes();
}

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

/**
 * Returns the number of elements in the off-heap store.
 *
 * @return the number of elements in the off-heap store
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
@Deprecated public long getOffHeapStoreSize() throws IllegalStateException {
  checkStatus();
  return getStatistics().getLocalOffHeapSize();
}

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

/**
 * Returns the number of elements in the memory store.
 *
 * @return the number of elements in the memory store
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
@Deprecated public final long getMemoryStoreSize() throws IllegalStateException {
  checkStatus();
  return getStatistics().getLocalHeapSize();
}

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

/**
 * {@inheritDoc}
 */
public void waitUntilClusterBulkLoadComplete() throws UnsupportedOperationException, TerracottaNotRunningException {
  checkStatus();
  try {
    compoundStore.waitUntilClusterCoherent();
  } catch (InterruptedException e) {
    // re-throw as cacheException
    throw new CacheException(e);
  }
}

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

/**
 * Flushes all cache items from memory to the disk store, and from the DiskStore to disk.
 *
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public final synchronized void flush() throws IllegalStateException, CacheException {
  checkStatus();
  try {
    compoundStore.flush();
  } catch (IOException e) {
    throw new CacheException("Unable to flush cache: " + configuration.getName()
        + ". Initial cause was " + e.getMessage(), e);
  }
}

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

/**
 * Returns the number of elements in the disk store.
 *
 * @return the number of elements in the disk store.
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
@Deprecated public final int getDiskStoreSize() throws IllegalStateException {
  checkStatus();
  if (isTerracottaClustered()) {
    return (int) getStatistics().getRemoteSize();
  } else {
    return (int) getStatistics().getLocalDiskSize();
  }
}

相关文章

Cache类方法