[hornetq-commits] JBoss hornetq SVN: r10391 - in branches/Branch_2_2_EAP/src/main/org/hornetq/core: settings and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 28 09:52:31 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-03-28 09:52:31 -0400 (Mon, 28 Mar 2011)
New Revision: 10391

Modified:
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
Log:
https://issues.jboss.org/browse/JBPAPP-6153 - fixing another small possibility of missing messages

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-03-28 13:10:11 UTC (rev 10390)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java	2011-03-28 13:52:31 UTC (rev 10391)
@@ -1532,7 +1532,7 @@
    {
       for (Map.Entry<String, Set<Role>> entry : configuration.getSecurityRoles().entrySet())
       {
-         securityRepository.addMatch(entry.getKey(), entry.getValue());
+         securityRepository.addMatch(entry.getKey(), entry.getValue(), true);
       }
    }
 
@@ -1552,7 +1552,7 @@
    {
       for (Map.Entry<String, AddressSettings> entry : configuration.getAddressesSettings().entrySet())
       {
-         addressSettingsRepository.addMatch(entry.getKey(), entry.getValue());
+         addressSettingsRepository.addMatch(entry.getKey(), entry.getValue(), true);
       }
    }
 

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java	2011-03-28 13:10:11 UTC (rev 10390)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java	2011-03-28 13:52:31 UTC (rev 10391)
@@ -26,6 +26,8 @@
     * @param value the value to hold agains the match
     */
    void addMatch(String match, T value);
+   
+   void addMatch(String match, T value, boolean immutableMatch);
 
    /**
     * return the value held against the nearest match

Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java	2011-03-28 13:10:11 UTC (rev 10390)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java	2011-03-28 13:52:31 UTC (rev 10391)
@@ -17,8 +17,10 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.hornetq.core.logging.Logger;
@@ -45,6 +47,15 @@
     * all the matches
     */
    private final Map<String, Match<T>> matches = new HashMap<String, Match<T>>();
+   
+   /**
+    * Certain values cannot be removed after installed.
+    * This is because we read a few records from the main config.
+    * JBoss AS deployer may remove them on undeploy, while we don't want to accept that since
+    * this could cause issues on shutdown.
+    * Notice you can still change these values. You just can't remove them.
+    */
+   private final Set<String> immutables = new HashSet<String>();
 
    /**
     * a regex comparator
@@ -61,15 +72,26 @@
     */
    private final ArrayList<HierarchicalRepositoryChangeListener> listeners = new ArrayList<HierarchicalRepositoryChangeListener>();
 
+   
+   public void addMatch(final String match, final T value)
+   {
+      addMatch(match, value, false);
+   }
+   
+
    /**
     * Add a new match to the repository
     *
     * @param match The regex to use to match against
     * @param value the value to hold agains the match
     */
-   public void addMatch(final String match, final T value)
+   public void addMatch(final String match, final T value, final boolean immutableMatch)
    {
       clearCache();
+      if (immutableMatch)
+      {
+         immutables.add(match);
+      }
       Match.verify(match);
       Match<T> match1 = new Match<T>(match);
       match1.setValue(value);
@@ -158,9 +180,18 @@
     */
    public void removeMatch(final String match)
    {
-      matches.remove(match);
-      clearCache();
-      onChange();
+      new Exception("Removing match " + match).printStackTrace();
+      boolean isImmutable = immutables.contains(match);
+      if (isImmutable)
+      {
+         log.info("Cannot remove match "  + match + " since it came from a main config");
+      }
+      else
+      {
+         matches.remove(match);
+         clearCache();
+         onChange();
+      }
    }
 
    public void registerListener(final HierarchicalRepositoryChangeListener listener)



More information about the hornetq-commits mailing list