curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: Use isTraceEnabled to prevent unnecessary string concat
Date Wed, 25 Sep 2013 03:31:36 GMT
Updated Branches:
  refs/heads/CURATOR-9 [created] 852e3fd3f


Use isTraceEnabled to prevent unnecessary string concat


Project: http://git-wip-us.apache.org/repos/asf/incubator-curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-curator/commit/852e3fd3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-curator/tree/852e3fd3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-curator/diff/852e3fd3

Branch: refs/heads/CURATOR-9
Commit: 852e3fd3f9e7a15a4bebbf97014b032f9c307ed8
Parents: bb663fd
Author: randgalt <randgalt@apache.org>
Authored: Tue Sep 24 20:32:48 2013 -0700
Committer: randgalt <randgalt@apache.org>
Committed: Tue Sep 24 20:32:48 2013 -0700

----------------------------------------------------------------------
 .../org/apache/curator/utils/DefaultTracerDriver.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/852e3fd3/curator-client/src/main/java/org/apache/curator/utils/DefaultTracerDriver.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/DefaultTracerDriver.java
b/curator-client/src/main/java/org/apache/curator/utils/DefaultTracerDriver.java
index 632a479..e6bdabb 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/DefaultTracerDriver.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/DefaultTracerDriver.java
@@ -33,12 +33,18 @@ public class DefaultTracerDriver implements TracerDriver
     @Override
     public void addTrace(String name, long time, TimeUnit unit)
     {
-        log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
+        if ( log.isTraceEnabled() )
+        {
+            log.trace("Trace: " + TimeUnit.MILLISECONDS.convert(time, unit) + " ms");
+        }
     }
 
     @Override
     public void addCount(String name, int increment)
     {
-        log.trace("Counter " + name + ": " + increment);
+        if ( log.isTraceEnabled() )
+        {
+            log.trace("Counter " + name + ": " + increment);
+        }
     }
 }


Mime
View raw message