You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2018/07/26 16:56:27 UTC

[juneau] branch master updated: Don't render cache hits in console by default.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new b0cef70  Don't render cache hits in console by default.
b0cef70 is described below

commit b0cef701c7c016e315f0e645adb44a80001079aa
Author: JamesBognar <ja...@apache.org>
AuthorDate: Thu Jul 26 12:55:42 2018 -0400

    Don't render cache hits in console by default.
---
 .../juneau-marshall/src/main/java/org/apache/juneau/ContextCache.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextCache.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextCache.java
index 4add812..73fa0fe 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextCache.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ContextCache.java
@@ -41,7 +41,7 @@ public class ContextCache {
 	private final ConcurrentHashMap<Class<?>,String[]> prefixCache = new ConcurrentHashMap<>();
 
 	// When enabled, this will spit out cache-hit metrics to the console on shutdown.
-	private static final boolean TRACK_CACHE_HITS = true;
+	private static final boolean TRACK_CACHE_HITS = Boolean.getBoolean("juneau.trackCacheHits");
 	static final Map<String,CacheHit> CACHE_HITS = new ConcurrentHashMap<>();
 	static {
 		if (TRACK_CACHE_HITS) {
@@ -50,6 +50,7 @@ public class ContextCache {
 					@Override
 					public void run() {
 						int creates=0, cached=0;
+						System.out.println("Cache Hits:  [CacheObject] = [numCreated,numCached,cacheHitPercentage]");
 						for (Map.Entry<String,CacheHit> e : CACHE_HITS.entrySet()) {
 							CacheHit ch = e.getValue();
 							System.out.println("["+e.getKey()+"] = ["+ch.creates+","+ch.cached+","+((ch.cached*100)/(ch.creates+ch.cached))+"%]");