- Minor optimization
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 4 Mar 2007 20:38:54 +0000 (20:38 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 4 Mar 2007 20:38:54 +0000 (20:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@514468 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java

index ca103fe..8133029 100644 (file)
@@ -38,6 +38,7 @@ public class MbeansDescriptorsDigesterSource extends ModelerSource
     String type;
     Object source;
     List mbeans=new ArrayList();
+    protected static Digester digester = null;
     
     protected static Digester createDigester(Registry registry) {
 
@@ -218,18 +219,24 @@ public class MbeansDescriptorsDigesterSource extends ModelerSource
 
         InputStream stream = (InputStream) source;
 
-        Digester digester = createDigester(registry);
-        // Push our registry object onto the stack
-        digester.push(mbeans);
-        
-        // Process the input file to configure our registry
-        try {
-            digester.parse(stream);
-        } catch (Exception e) {
-            log.error("Error digesting Registry data", e);
-            throw e;
-        } finally {
-            digester.reset();
+        if (digester == null) {
+            digester = createDigester(registry);
+        }
+        
+        synchronized (digester) {
+
+            // Process the input file to configure our registry
+            try {
+                // Push our registry object onto the stack
+                digester.push(mbeans);
+                digester.parse(stream);
+            } catch (Exception e) {
+                log.error("Error digesting Registry data", e);
+                throw e;
+            } finally {
+                digester.reset();
+            }
+        
         }
             
     }