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

x33g5p2x  于2022-01-19 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(213)

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

Ehcache.isStatisticsEnabled介绍

[英]Returns true if statistics collection is enabled
[中]如果启用了统计信息收集,则返回true

代码示例

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public boolean isStatisticsEnabled() {
  return cache.isStatisticsEnabled();
}

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

/**
 * {@inheritDoc}
 */
public boolean isStatisticsEnabled() {
  return underlyingCache.isStatisticsEnabled();
}

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

/**
 * {@inheritDoc}
 */
public boolean isStatisticsEnabled() {
  return cache.isStatisticsEnabled();
}

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

/**
 * {@inheritDoc}
 */
public boolean isStatisticsEnabled() {
  return cache.isStatisticsEnabled();
}

代码示例来源:origin: rtyley/mini-git-server

public boolean isStatisticsEnabled() {
 return self.isStatisticsEnabled();
}

代码示例来源:origin: com.madgag/mini-git-server-server

public boolean isStatisticsEnabled() {
 return self.isStatisticsEnabled();
}

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

/**
* {@inheritDoc}
*/
public boolean isStatisticsEnabled() {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.isStatisticsEnabled();
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
  public Properties getAll() {
    CacheConfiguration cc = cache.getCacheConfiguration();
    Properties p = new Properties();
    p.put("maxEntries", cc.getMaxEntriesLocalHeap());
    p.put("timeToLiveSeconds", cc.getTimeToLiveSeconds());
    p.put("timeToIdleSeconds", cc.getTimeToIdleSeconds());
    p.put("eternal", cc.isEternal());
    p.put("statisticsEnabled", cache.isStatisticsEnabled());
    return p;
  }
};

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public String getDescription() {
  final StringBuilder buf = new StringBuilder();
  buf.append(cache.getName()).append(" Ehcache");
  if (loader != null) {
    buf.append(" Loader");
  }
  if (cacheEventListener != null) {
    buf.append(" Listener");
  }
  if (isDistributed()) {
    buf.append(" Distributed");
  }
  final long hits = cache.getStatistics().getCacheHits();
  final long misses = cache.getStatistics().getCacheMisses();
  final long total = hits + misses;
  final long hitRatio = ((total > 0) ? ((100l * hits) / total) : 0);
  // Even when we're not collecting statistics ehcache knows how many objects are in the cache
  buf.append(": ").append(" count:").append(cache.getStatistics().getObjectCount());
  if (cache.isStatisticsEnabled()) {
    buf.append(" hits:").append(hits).append(" misses:").append(misses).append(" hit%:").append(hitRatio);
  } else {
    buf.append(" NO statistics (not enabled for cache)");
  }
  return buf.toString();
}

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

/**
 * {@inheritDoc}
 */
public void disableStatistics() {
  if (cache.isStatisticsEnabled()) {
    try {
      cache.setSampledStatisticsEnabled(false);
      cache.setStatisticsEnabled(false);
    } catch (RuntimeException e) {
      throw Utils.newPlainException(e);
    }
  }
}

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

/**
 * {@inheritDoc}
 */
public void enableStatistics() {
  if (!cache.isStatisticsEnabled()) {
    try {
      cache.setSampledStatisticsEnabled(true);
      cache.setStatisticsEnabled(true);
    } catch (RuntimeException e) {
      throw Utils.newPlainException(e);
    }
  }
}

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

private void registerCacheMBean(Ehcache cache) throws InstanceAlreadyExistsException, MBeanRegistrationException,
    NotCompliantMBeanException {
  // enable sampled stats
  if (cache.isStatisticsEnabled()) {
   cache.setSampledStatisticsEnabled(true);
  }
  SampledCache terracottaCacheMBean = new SampledCache(cache);
  try {
    ObjectName cacheObjectName = SampledEhcacheMBeans.getCacheObjectName(clientUUID, registeredCacheManagerName,
        terracottaCacheMBean.getImmutableCacheName());
    mBeanServer.registerMBean(terracottaCacheMBean,
        cacheObjectName);
    mbeans.put(cacheObjectName, terracottaCacheMBean);
  } catch (MalformedObjectNameException e) {
    throw new MBeanRegistrationException(e);
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public Properties getProperties(boolean includeExpensiveDetails) {
  Properties p = new Properties();
  p.put("name", cache.getName());
  p.put("class", this.getClass().getSimpleName());
  p.put("cacheClass", cache.getClass().getName());
  p.put("guid", cache.getGuid());
  p.put("disabled", cache.isDisabled());
  p.put("statsEnabled", cache.isStatisticsEnabled());
  p.put("status", cache.getStatus().toString());
  p.put("maxEntries", cache.getCacheConfiguration().getMaxEntriesLocalHeap());
  p.put("timeToLiveSecs", cache.getCacheConfiguration().getTimeToLiveSeconds());
  p.put("timeToIdleSecs", cache.getCacheConfiguration().getTimeToIdleSeconds());
  p.put("distributed", isDistributed());
  p.put("eternal", cache.getCacheConfiguration().isEternal());
  if (includeExpensiveDetails) {
    p.put("size", cache.getSize());
    p.put("avgGetTime", cache.getStatistics().getAverageGetTime());
    p.put("hits", cache.getStatistics().getCacheHits());
    p.put("misses", cache.getStatistics().getCacheMisses());
    p.put("evictions", cache.getStatistics().getEvictionCount());
    p.put("count", cache.getStatistics().getMemoryStoreObjectCount());
    p.put("searchPerSec", cache.getStatistics().getSearchesPerSecond());
  }
  return p;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

enabled = !serverConfigurationService.getBoolean("memory.cache.statistics.force.disabled", false);
if (cache.isStatisticsEnabled() != enabled) {
  cache.setStatisticsEnabled(enabled);

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

element = underlyingCache.getQuiet(key);
if (element != null) {
  if (underlyingCache.isStatisticsEnabled()) {
    element = underlyingCache.get(key);

相关文章

Ehcache类方法