[jboss-cvs] JBossAS SVN: r91243 - projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 14 16:13:56 EDT 2009


Author: alesj
Date: 2009-07-14 16:13:56 -0400 (Tue, 14 Jul 2009)
New Revision: 91243

Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
Log:
Synch ex handlers.

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2009-07-14 20:12:35 UTC (rev 91242)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2009-07-14 20:13:56 UTC (rev 91243)
@@ -68,6 +68,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.util.collection.CollectionsFactory;
 
 /**
  * DeployersImpl.
@@ -135,7 +136,7 @@
    private ManagedObjectCreator mgtObjectCreator = null;
 
    /** The exception handlers */
-   private Set<ExceptionHandler<? extends Throwable>> exceptionHandlers = new HashSet<ExceptionHandler<? extends Throwable>>();
+   private final Set<ExceptionHandler<? extends Throwable>> exceptionHandlers = CollectionsFactory.createLazySet();
 
    /**
     * Create a new DeployersImpl.
@@ -367,6 +368,20 @@
    }
 
    /**
+    * Check exception handler.
+    *
+    * @param handler the handler
+    */
+   protected void checkExceptionHandler(ExceptionHandler<? extends Throwable> handler)
+   {
+      if (handler == null)
+         throw new IllegalArgumentException("Null handler");
+
+      if (handler.getExceptionType() == null)
+         throw new IllegalArgumentException("Null exception type: " + handler);
+   }
+
+   /**
     * Set exception handlers.
     *
     * @param exceptionHandlers the exception handlers
@@ -379,24 +394,13 @@
       for (ExceptionHandler<? extends Throwable> handler : exceptionHandlers)
          checkExceptionHandler(handler);
 
-      this.exceptionHandlers = exceptionHandlers;
+      synchronized (this.exceptionHandlers)
+      {
+         this.exceptionHandlers.addAll(exceptionHandlers);
+      }
    }
 
    /**
-    * Check exception handler.
-    *
-    * @param handler the handler
-    */
-   protected void checkExceptionHandler(ExceptionHandler<? extends Throwable> handler)
-   {
-      if (handler == null)
-         throw new IllegalArgumentException("Null handler");
-
-      if (handler.getExceptionType() == null)
-         throw new IllegalArgumentException("Null exception type: " + handler);
-   }
-
-   /**
     * Add exception handler.
     *
     * @param handler the exception handler
@@ -405,7 +409,10 @@
    public boolean addExceptionHandler(ExceptionHandler<? extends Throwable> handler)
    {
       checkExceptionHandler(handler);
-      return exceptionHandlers.add(handler);
+      synchronized (this.exceptionHandlers)
+      {
+         return exceptionHandlers.add(handler);
+      }
    }
 
    /**
@@ -419,7 +426,10 @@
       if (handler == null)
          throw new IllegalArgumentException("Null handler");
 
-      return exceptionHandlers.remove(handler);
+      synchronized (this.exceptionHandlers)
+      {
+         return exceptionHandlers.remove(handler);
+      }
    }
 
    /**




More information about the jboss-cvs-commits mailing list