commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r821659 - /commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/
Date Mon, 05 Oct 2009 02:06:45 GMT
Author: rgoers
Date: Mon Oct  5 02:06:44 2009
New Revision: 821659

URL: http://svn.apache.org/viewvc?rev=821659&view=rev
Log:
Eliminate need to lock api methods

Modified:
    commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/CombinedConfiguration.java
    commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
    commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/Lock.java
    commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
    commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java

Modified: commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/CombinedConfiguration.java?rev=821659&r1=821658&r2=821659&view=diff
==============================================================================
--- commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/CombinedConfiguration.java
(original)
+++ commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/CombinedConfiguration.java
Mon Oct  5 02:06:44 2009
@@ -823,23 +823,26 @@
      */
     private Configuration findSourceConfiguration(ConfigurationNode node)
     {
-        ConfigurationNode root = null;
-        ConfigurationNode current = node;
-
-        // find the root node in this hierarchy
-        while (current != null)
+        synchronized(getReloadLock())
         {
-            root = current;
-            current = current.getParentNode();
-        }
+            ConfigurationNode root = null;
+            ConfigurationNode current = node;
 
-        // Check with the root nodes of the child configurations
-        for (Iterator it = configurations.iterator(); it.hasNext();)
-        {
-            ConfigData cd = (ConfigData) it.next();
-            if (root == cd.getRootNode())
+            // find the root node in this hierarchy
+            while (current != null)
+            {
+                root = current;
+                current = current.getParentNode();
+            }
+
+            // Check with the root nodes of the child configurations
+            for (Iterator it = configurations.iterator(); it.hasNext();)
             {
-                return cd.getConfiguration();
+                ConfigData cd = (ConfigData) it.next();
+                if (root == cd.getRootNode())
+                {
+                    return cd.getConfiguration();
+                }
             }
         }
 
@@ -949,11 +952,12 @@
             }
 
             // Copy data of the root node to the new path
-            rootNode = ConfigurationUtils
+            ConfigurationNode root = ConfigurationUtils
                     .convertToHierarchical(getConfiguration(),
                             getConversionExpressionEngine()).getRootNode();
-            atParent.appendChildren(rootNode);
-            atParent.appendAttributes(rootNode);
+            atParent.appendChildren(root);
+            atParent.appendAttributes(root);
+            rootNode = root;
 
             return result;
         }

Modified: commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java?rev=821659&r1=821658&r2=821659&view=diff
==============================================================================
--- commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
(original)
+++ commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/HierarchicalReloadableConfiguration.java
Mon Oct  5 02:06:44 2009
@@ -53,156 +53,4 @@
     {
         return reloadLock;
     }
-
-    public Object getProperty(String key)
-    {
-        synchronized(reloadLock)
-        {
-            return super.getProperty(key);
-        }
-    }
-
-    protected void addPropertyDirect(String key, Object obj)
-    {
-        synchronized(reloadLock)
-        {
-            super.addPropertyDirect(key, obj);
-        }
-    }
-
-    public void addNodes(String key, Collection nodes)
-    {
-        synchronized(reloadLock)
-        {
-            super.addNodes(key, nodes);
-        }
-    }
-
-    public boolean isEmpty()
-    {
-        synchronized(reloadLock)
-        {
-            return super.isEmpty();
-        }
-    }
-
-    public Configuration subset(String prefix)
-    {
-        synchronized(reloadLock)
-        {
-            return super.subset(prefix);
-        }
-    }
-
-    public SubnodeConfiguration configurationAt(String key, boolean supportUpdates)
-    {
-        synchronized(reloadLock)
-        {
-            return super.configurationAt(key, supportUpdates);
-        }
-    }
-
-    public SubnodeConfiguration configurationAt(String key)
-    {
-        synchronized(reloadLock)
-        {
-            return super.configurationAt(key);
-        }
-    }
-
-    public List configurationsAt(String key)
-    {
-        synchronized(reloadLock)
-        {
-            return super.configurationsAt(key);
-        }
-    }
-
-    protected SubnodeConfiguration createSubnodeConfiguration(ConfigurationNode node)
-    {
-        synchronized(reloadLock)
-        {
-            return super.createSubnodeConfiguration(node);
-        }
-    }
-
-    protected SubnodeConfiguration createSubnodeConfiguration(ConfigurationNode node, String
subnodeKey)
-    {
-        synchronized(reloadLock)
-        {
-            return super.createSubnodeConfiguration(node, subnodeKey);
-        }
-    }
-
-    protected void subnodeConfigurationChanged(ConfigurationEvent event)
-    {
-        synchronized(reloadLock)
-        {
-            super.subnodeConfigurationChanged(event);
-        }
-    }
-
-    void registerSubnodeConfiguration(SubnodeConfiguration config)
-    {
-        synchronized(reloadLock)
-        {
-            super.registerSubnodeConfiguration(config);
-        }
-    }
-
-    public boolean containsKey(String key)
-    {
-        synchronized(reloadLock)
-        {
-            return super.containsKey(key);
-        }
-    }
-
-    public void setProperty(String key, Object value)
-    {
-        synchronized(reloadLock)
-        {
-            super.setProperty(key, value);
-        }
-    }
-
-    public void clearTree(String key)
-    {
-        synchronized(reloadLock)
-        {
-            super.clearTree(key);
-        }
-    }
-
-    public void clearProperty(String key)
-    {
-        synchronized(reloadLock)
-        {
-            super.clearProperty(key);
-        }
-    }
-
-    public Iterator getKeys()
-    {
-        synchronized(reloadLock)
-        {
-            return super.getKeys();
-        }
-    }
-
-    public Iterator getKeys(String prefix)
-    {
-        synchronized(reloadLock)
-        {
-            return super.getKeys(prefix);
-        }
-    }
-
-    public int getMaxIndex(String key)
-    {
-        synchronized(reloadLock)
-        {
-            return super.getMaxIndex(key);
-        }
-    }
 }

Modified: commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/Lock.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/Lock.java?rev=821659&r1=821658&r2=821659&view=diff
==============================================================================
--- commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/Lock.java
(original)
+++ commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/Lock.java
Mon Oct  5 02:06:44 2009
@@ -31,6 +31,6 @@
 
     public String toString()
     {
-        return "Lock: " + name + " id = " + instanceId;
+        return "Lock: " + name + " id = " + instanceId + ": " + super.toString();
     }
 }

Modified: commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java?rev=821659&r1=821658&r2=821659&view=diff
==============================================================================
--- commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
(original)
+++ commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/MultiFileHierarchicalConfiguration.java
Mon Oct  5 02:06:44 2009
@@ -408,6 +408,11 @@
         return this.getConfiguration().subset(prefix);
     }
 
+    public Object getReloadLock()
+    {
+        return this.getConfiguration().getReloadLock();
+    }
+
     public Node getRoot()
     {
         return this.getConfiguration().getRoot();

Modified: commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java?rev=821659&r1=821658&r2=821659&view=diff
==============================================================================
--- commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
(original)
+++ commons/proper/configuration/branches/CONFIGURATION_390/src/java/org/apache/commons/configuration/PatternSubtreeConfigurationWrapper.java
Mon Oct  5 02:06:44 2009
@@ -78,6 +78,11 @@
         this.init = true;
     }
 
+    public Object getReloadLock()
+    {
+        return config.getReloadLock();
+    }
+
     public void addProperty(String key, Object value)
     {
         config.addProperty(makePath(key), value);



Mime
View raw message