Author: gtully
Date: Fri Aug  7 13:16:56 2009
New Revision: 801989

URL: http://svn.apache.org/viewvc?rev=801989&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2350 - amq may not have 
exclusive access to the propertyEditorManager

Modified:
    
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java

Modified: 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?rev=801989&r1=801988&r2=801989&view=diff
==============================================================================
--- 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
 (original)
+++ 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java
 Fri Aug  7 13:16:56 2009
@@ -42,16 +42,18 @@
                String[] additionalPath = new String[] {
                                "org.springframework.beans.propertyeditors",
                                "org.apache.activemq.util" };
-
-               String[] searchPath = (String[]) Array.newInstance(String.class,
-                               
PropertyEditorManager.getEditorSearchPath().length
-                                               + additionalPath.length);
-               System.arraycopy(PropertyEditorManager.getEditorSearchPath(), 0,
-                               searchPath, 0,
-                               
PropertyEditorManager.getEditorSearchPath().length);
-               System.arraycopy(additionalPath, 0, searchPath, 
PropertyEditorManager
-                               .getEditorSearchPath().length, 
additionalPath.length);
-               PropertyEditorManager.setEditorSearchPath(searchPath);
+               synchronized (PropertyEditorManager.class) {
+                   String[] existingSearchPath = 
PropertyEditorManager.getEditorSearchPath();
+                   String[] newSearchPath = (String[]) 
Array.newInstance(String.class,
+                           existingSearchPath.length + additionalPath.length);
+                   System.arraycopy(existingSearchPath, 0,
+                           newSearchPath, 0,
+                           existingSearchPath.length);
+                   System.arraycopy(additionalPath, 0, 
+                           newSearchPath, existingSearchPath.length,
+                           additionalPath.length);
+                   PropertyEditorManager.setEditorSearchPath(newSearchPath);
+               }
        }
     
     private IntrospectionSupport() {


Reply via email to