[jboss-cvs] JBossAS SVN: r59677 - projects/aop/trunk/aop/src/main/org/jboss/aop/instrument.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 16 14:15:48 EST 2007


Author: flavia.rainone at jboss.com
Date: 2007-01-16 14:15:42 -0500 (Tue, 16 Jan 2007)
New Revision: 59677

Modified:
   projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
Log:
[JBAOP-37] Inserted initialization of ThreadLocal variable

Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2007-01-16 18:31:45 UTC (rev 59676)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/instrument/JoinPointGenerator.java	2007-01-16 19:15:42 UTC (rev 59677)
@@ -1745,23 +1745,17 @@
    
    private static class AroundAdviceCallStrategy extends AdviceCallStrategy
    {
-      private static ThreadLocal<AroundAdviceCallStrategy> INSTANCE;
-      
-      static
-      {
-         INSTANCE = new ThreadLocal<AroundAdviceCallStrategy>();
-         INSTANCE.set(new AroundAdviceCallStrategy());
-      }
-      
+      private static ThreadLocal<AroundAdviceCallStrategy> INSTANCE =
+         new ThreadLocal<AroundAdviceCallStrategy>()
+         {
+            protected synchronized AroundAdviceCallStrategy initialValue() {
+               return new AroundAdviceCallStrategy();
+            }
+         };
+   
       public static final AroundAdviceCallStrategy getInstance()
       {
-         AroundAdviceCallStrategy strategy = INSTANCE.get();
-         if (strategy == null)
-         {
-            strategy = new AroundAdviceCallStrategy();
-            INSTANCE.set(strategy);
-         }
-         return strategy;
+         return INSTANCE.get();
       }
       
       private AroundAdviceCallStrategy() {}




More information about the jboss-cvs-commits mailing list