zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1613323 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
Date Thu, 24 Jul 2014 22:58:38 GMT
Author: phunt
Date: Thu Jul 24 22:58:38 2014
New Revision: 1613323

URL: http://svn.apache.org/r1613323
Log:
ZOOKEEPER-1986. refactor log trace on touchSession (Hongchao Deng via phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1613323&r1=1613322&r2=1613323&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Thu Jul 24 22:58:38 2014
@@ -1023,6 +1023,9 @@ IMPROVEMENTS:
   ZOOKEEPER-927. there are currently 24 RAT warnings in the build --
   address directly or via exclusions (Michi Mutsuzaki via phunt)
 
+  ZOOKEEPER-1986. refactor log trace on touchSession
+  (Hongchao Deng via phunt)
+
 headers
 
 Release 3.4.0 - 

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java?rev=1613323&r1=1613322&r2=1613323&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java Thu
Jul 24 22:58:38 2014
@@ -20,6 +20,7 @@ package org.apache.zookeeper.server;
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.text.MessageFormat;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -179,20 +180,22 @@ public class SessionTrackerImpl extends 
     }
 
     private void logTraceTouchSession(long sessionId, int timeout, String sessionStatus){
-        if (LOG.isTraceEnabled()) {
-            ZooTrace.logTraceMessage(LOG,
-                    ZooTrace.CLIENT_PING_TRACE_MASK,
-                    "SessionTrackerImpl --- Touch " + sessionStatus + "session: 0x"
-                            + Long.toHexString(sessionId) + " with timeout " + timeout);
-        }
+        if (!LOG.isTraceEnabled())
+            return;
+
+        String msg = MessageFormat.format(
+                "SessionTrackerImpl --- Touch {0}session: 0x{1} with timeout {2}",
+                sessionStatus, Long.toHexString(sessionId), Integer.toString(timeout));
+
+        ZooTrace.logTraceMessage(LOG, ZooTrace.CLIENT_PING_TRACE_MASK, msg);
     }
 
     private void logTraceTouchInvalidSession(long sessionId, int timeout) {
-        logTraceTouchSession(sessionId, timeout, "invalid");
+        logTraceTouchSession(sessionId, timeout, "invalid ");
     }
 
     private void logTraceTouchClosingSession(long sessionId, int timeout) {
-        logTraceTouchSession(sessionId, timeout, "closing");
+        logTraceTouchSession(sessionId, timeout, "closing ");
     }
 
     public int getSessionTimeout(long sessionId) {



Mime
View raw message