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

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

本文整理了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

  1. @Override
  2. public boolean isStatisticsEnabled() {
  3. return cache.isStatisticsEnabled();
  4. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean isStatisticsEnabled() {
  5. return underlyingCache.isStatisticsEnabled();
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean isStatisticsEnabled() {
  5. return cache.isStatisticsEnabled();
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean isStatisticsEnabled() {
  5. return cache.isStatisticsEnabled();
  6. }

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

  1. public boolean isStatisticsEnabled() {
  2. return self.isStatisticsEnabled();
  3. }

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

  1. public boolean isStatisticsEnabled() {
  2. return self.isStatisticsEnabled();
  3. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean isStatisticsEnabled() {
  5. // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  6. Thread t = Thread.currentThread();
  7. ClassLoader prev = t.getContextClassLoader();
  8. t.setContextClassLoader(this.classLoader);
  9. try {
  10. return this.cache.isStatisticsEnabled();
  11. } finally {
  12. t.setContextClassLoader(prev);
  13. }
  14. }

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

  1. @Override
  2. public Properties getAll() {
  3. CacheConfiguration cc = cache.getCacheConfiguration();
  4. Properties p = new Properties();
  5. p.put("maxEntries", cc.getMaxEntriesLocalHeap());
  6. p.put("timeToLiveSeconds", cc.getTimeToLiveSeconds());
  7. p.put("timeToIdleSeconds", cc.getTimeToIdleSeconds());
  8. p.put("eternal", cc.isEternal());
  9. p.put("statisticsEnabled", cache.isStatisticsEnabled());
  10. return p;
  11. }
  12. };

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

  1. @Override
  2. public String getDescription() {
  3. final StringBuilder buf = new StringBuilder();
  4. buf.append(cache.getName()).append(" Ehcache");
  5. if (loader != null) {
  6. buf.append(" Loader");
  7. }
  8. if (cacheEventListener != null) {
  9. buf.append(" Listener");
  10. }
  11. if (isDistributed()) {
  12. buf.append(" Distributed");
  13. }
  14. final long hits = cache.getStatistics().getCacheHits();
  15. final long misses = cache.getStatistics().getCacheMisses();
  16. final long total = hits + misses;
  17. final long hitRatio = ((total > 0) ? ((100l * hits) / total) : 0);
  18. // Even when we're not collecting statistics ehcache knows how many objects are in the cache
  19. buf.append(": ").append(" count:").append(cache.getStatistics().getObjectCount());
  20. if (cache.isStatisticsEnabled()) {
  21. buf.append(" hits:").append(hits).append(" misses:").append(misses).append(" hit%:").append(hitRatio);
  22. } else {
  23. buf.append(" NO statistics (not enabled for cache)");
  24. }
  25. return buf.toString();
  26. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void disableStatistics() {
  5. if (cache.isStatisticsEnabled()) {
  6. try {
  7. cache.setSampledStatisticsEnabled(false);
  8. cache.setStatisticsEnabled(false);
  9. } catch (RuntimeException e) {
  10. throw Utils.newPlainException(e);
  11. }
  12. }
  13. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void enableStatistics() {
  5. if (!cache.isStatisticsEnabled()) {
  6. try {
  7. cache.setSampledStatisticsEnabled(true);
  8. cache.setStatisticsEnabled(true);
  9. } catch (RuntimeException e) {
  10. throw Utils.newPlainException(e);
  11. }
  12. }
  13. }

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

  1. private void registerCacheMBean(Ehcache cache) throws InstanceAlreadyExistsException, MBeanRegistrationException,
  2. NotCompliantMBeanException {
  3. // enable sampled stats
  4. if (cache.isStatisticsEnabled()) {
  5. cache.setSampledStatisticsEnabled(true);
  6. }
  7. SampledCache terracottaCacheMBean = new SampledCache(cache);
  8. try {
  9. ObjectName cacheObjectName = SampledEhcacheMBeans.getCacheObjectName(clientUUID, registeredCacheManagerName,
  10. terracottaCacheMBean.getImmutableCacheName());
  11. mBeanServer.registerMBean(terracottaCacheMBean,
  12. cacheObjectName);
  13. mbeans.put(cacheObjectName, terracottaCacheMBean);
  14. } catch (MalformedObjectNameException e) {
  15. throw new MBeanRegistrationException(e);
  16. }
  17. }

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

  1. @Override
  2. public Properties getProperties(boolean includeExpensiveDetails) {
  3. Properties p = new Properties();
  4. p.put("name", cache.getName());
  5. p.put("class", this.getClass().getSimpleName());
  6. p.put("cacheClass", cache.getClass().getName());
  7. p.put("guid", cache.getGuid());
  8. p.put("disabled", cache.isDisabled());
  9. p.put("statsEnabled", cache.isStatisticsEnabled());
  10. p.put("status", cache.getStatus().toString());
  11. p.put("maxEntries", cache.getCacheConfiguration().getMaxEntriesLocalHeap());
  12. p.put("timeToLiveSecs", cache.getCacheConfiguration().getTimeToLiveSeconds());
  13. p.put("timeToIdleSecs", cache.getCacheConfiguration().getTimeToIdleSeconds());
  14. p.put("distributed", isDistributed());
  15. p.put("eternal", cache.getCacheConfiguration().isEternal());
  16. if (includeExpensiveDetails) {
  17. p.put("size", cache.getSize());
  18. p.put("avgGetTime", cache.getStatistics().getAverageGetTime());
  19. p.put("hits", cache.getStatistics().getCacheHits());
  20. p.put("misses", cache.getStatistics().getCacheMisses());
  21. p.put("evictions", cache.getStatistics().getEvictionCount());
  22. p.put("count", cache.getStatistics().getMemoryStoreObjectCount());
  23. p.put("searchPerSec", cache.getStatistics().getSearchesPerSecond());
  24. }
  25. return p;
  26. }

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

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

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

  1. element = underlyingCache.getQuiet(key);
  2. if (element != null) {
  3. if (underlyingCache.isStatisticsEnabled()) {
  4. element = underlyingCache.get(key);

相关文章

Ehcache类方法