[jboss-svn-commits] JBoss Common SVN: r3519 - common-old/branches/JBossCommon_1_2_1_GA_CP/src/main/org/jboss/util.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 14 09:47:20 EDT 2009


Author: darran.lofthouse at jboss.com
Date: 2009-09-14 09:47:20 -0400 (Mon, 14 Sep 2009)
New Revision: 3519

Modified:
   common-old/branches/JBossCommon_1_2_1_GA_CP/src/main/org/jboss/util/NestedThrowable.java
Log:
[JBPAPP-2778] NestedThrowable Class when accessed concurrently by 2 Threads cause deadlock.

Modified: common-old/branches/JBossCommon_1_2_1_GA_CP/src/main/org/jboss/util/NestedThrowable.java
===================================================================
--- common-old/branches/JBossCommon_1_2_1_GA_CP/src/main/org/jboss/util/NestedThrowable.java	2009-09-14 13:20:08 UTC (rev 3518)
+++ common-old/branches/JBossCommon_1_2_1_GA_CP/src/main/org/jboss/util/NestedThrowable.java	2009-09-14 13:47:20 UTC (rev 3519)
@@ -110,7 +110,9 @@
    final class Util 
    {
       // Can not be final due to init bug, see getLogger() for details
-      private static Logger log = Logger.getLogger(NestedThrowable.class);
+	  // This variable should not be accessed directly so the getLogger method
+	  // will be able to check it is not null.
+      private static Logger pvtLog = null;
 
       /**
        * Something is very broken with class nesting, which can sometimes
@@ -122,10 +124,10 @@
        */
       private static Logger getLogger()
       {
-         if (log == null)
-            log = Logger.getLogger(NestedThrowable.class);
+         if (pvtLog == null)
+        	 pvtLog = Logger.getLogger(NestedThrowable.class);
 
-         return log;
+         return pvtLog;
       }
       
       /** A helper to get a boolean property. */
@@ -135,7 +137,7 @@
          String value = System.getProperty(name, String.valueOf(defaultValue));
 
          // HACK see getLogger() for details
-         log = getLogger();
+         Logger log = getLogger();
          
          log.debug(name + "=" + value);
 
@@ -160,7 +162,7 @@
          
          if (parentType.isAssignableFrom(childType)) {
             // HACK see getLogger() for details
-            log = getLogger();
+            Logger log = getLogger();
 
             log.warn("Duplicate throwable nesting of same base type: " +
                      parentType + " is assignable from: " + childType);



More information about the jboss-svn-commits mailing list