[jboss-svn-commits] JBL Code SVN: r26269 - labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Apr 26 08:33:02 EDT 2009


Author: kevin.conner at jboss.com
Date: 2009-04-26 08:32:59 -0400 (Sun, 26 Apr 2009)
New Revision: 26269

Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java
Log:
Fix synchronisation around lifecycle resource methods: JBESB-2513

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java	2009-04-26 11:47:09 UTC (rev 26268)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/couriers/CourierFactory.java	2009-04-26 12:32:59 UTC (rev 26269)
@@ -187,7 +187,7 @@
          * Register the courier as part of the current set.
          * @param courier The current courier.
          */
-        private static synchronized void registerCourier(final TwoWayCourier courier)
+        private static void registerCourier(final TwoWayCourier courier)
             throws CourierException
         {
             final Exception ex ;
@@ -199,25 +199,37 @@
             {
                 ex = null ;
             }
+            final Map<TwoWayCourier, Exception> map ;
             try
             {
-                lifecycleCouriers.getLifecycleResource().put(courier, ex) ;
+                map = lifecycleCouriers.getLifecycleResource() ;
             }
             catch (final LifecycleResourceException lre)
             {
                 throw new CourierException("Unexpected lifecycle resource exception while registering courier", lre) ;
             }
+            
+            synchronized(map)
+            {
+                map.put(courier, ex) ;
+            }
         }
         
         /**
          * Deregister the courier from the current set.
          * @param courier The current courier.
          */
-        public static synchronized void deregisterCourier(final TwoWayCourier courier)
+        public static void deregisterCourier(final TwoWayCourier courier)
         {
+            final Map<TwoWayCourier, Exception> map ;
             try
             {
-                lifecycleCouriers.getLifecycleResource().remove(courier) ;
+                map = lifecycleCouriers.getLifecycleResource() ;
+                
+                synchronized(map)
+                {
+                    map.remove(courier) ;
+                }
             }
             catch (final LifecycleResourceException lre)
             {




More information about the jboss-svn-commits mailing list