cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1501373 - /cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
Date Tue, 09 Jul 2013 16:41:30 GMT
Author: dkulp
Date: Tue Jul  9 16:41:29 2013
New Revision: 1501373

URL: http://svn.apache.org/r1501373
Log:
Some optimizations which also remove a PMD 5.0 error

Modified:
    cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java

Modified: cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java?rev=1501373&r1=1501372&r2=1501373&view=diff
==============================================================================
--- cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
(original)
+++ cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/LoggingThread.java
Tue Jul  9 16:41:29 2013
@@ -28,24 +28,24 @@ package org.apache.cxf.management.web.lo
  */
 final class LoggingThread {
 
-    private static ThreadLocal<LoggingThread> threadLocal = new ThreadLocal<LoggingThread>()
{
-        @Override
-        protected LoggingThread initialValue() {
-            return new LoggingThread();
-        }
-    };
-
-    private boolean isSilent;
+    private static ThreadLocal<Boolean> threadLocal = new ThreadLocal<Boolean>();
 
     private LoggingThread() {
     }
 
     public static void markSilent(boolean silent) {
-        LoggingThread lt = threadLocal.get();
-        lt.isSilent = silent;
+        if (silent) {
+            threadLocal.set(Boolean.TRUE);
+        } else {
+            threadLocal.remove();
+        }
     }
 
     public static boolean isSilent() {
-        return threadLocal.get().isSilent;
+        Boolean b = threadLocal.get();
+        if (b != null) {
+            return b;
+        }
+        return false;
     }
 }



Mime
View raw message