qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1162121 - in /qpid/trunk/qpid/java: broker/etc/ broker/src/main/java/org/apache/qpid/server/configuration/ broker/src/main/java/org/apache/qpid/server/virtualhost/ broker/src/test/java/org/apache/qpid/server/configuration/ broker/src/test/...
Date Fri, 26 Aug 2011 14:02:23 GMT
Author: kwall
Date: Fri Aug 26 14:02:22 2011
New Revision: 1162121

URL: http://svn.apache.org/viewvc?rev=1162121&view=rev
Log:
QPID-3266: Tidy up housekeeping configuration option for scheduling frequency

Modified:
    qpid/trunk/qpid/java/broker/etc/virtualhosts.xml
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutConfigurationTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java

Modified: qpid/trunk/qpid/java/broker/etc/virtualhosts.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/etc/virtualhosts.xml?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/etc/virtualhosts.xml (original)
+++ qpid/trunk/qpid/java/broker/etc/virtualhosts.xml Fri Aug 26 14:02:22 2011
@@ -31,7 +31,7 @@
 
             <housekeeping>
                 <threadCount>2</threadCount>
-                <expiredMessageCheckPeriod>20000</expiredMessageCheckPeriod>
+                <checkPeriod>20000</checkPeriod>
             </housekeeping>
 
             <exchanges>

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
(original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
Fri Aug 26 14:02:22 2011
@@ -227,6 +227,14 @@ public class ServerConfiguration extends
                     + (_configFile == null ? "" : " Configuration file : " + _configFile);
             throw new ConfigurationException(message);
         }
+
+        // QPID-3266.  Tidy up housekeeping configuration option for scheduling frequency
+        if (contains("housekeeping.expiredMessageCheckPeriod"))
+        {
+            String message = "Validation error : housekeeping/expiredMessageCheckPeriod must
be replaced by housekeeping/checkPeriod."
+                    + (_configFile == null ? "" : " Configuration file : " + _configFile);
+            throw new ConfigurationException(message);
+        }
     }
 
     /*
@@ -707,16 +715,14 @@ public class ServerConfiguration extends
          getConfig().setProperty("virtualhosts.default", vhost);
     }    
 
-    public void setHousekeepingExpiredMessageCheckPeriod(long value)
+    public void setHousekeepingCheckPeriod(long value)
     {
-        getConfig().setProperty("housekeeping.expiredMessageCheckPeriod", value);
+        getConfig().setProperty("housekeeping.checkPeriod", value);
     }
 
     public long getHousekeepingCheckPeriod()
     {
-        return getLongValue("housekeeping.checkPeriod",
-                                   getLongValue("housekeeping.expiredMessageCheckPeriod",
-                                                       DEFAULT_HOUSEKEEPING_PERIOD));
+        return getLongValue("housekeeping.checkPeriod", DEFAULT_HOUSEKEEPING_PERIOD);
     }
 
     public long getStatisticsSamplePeriod()

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
(original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/VirtualHostConfiguration.java
Fri Aug 26 14:02:22 2011
@@ -86,9 +86,9 @@ public class VirtualHostConfiguration ex
         return _name;
     }
 
-    public long getHousekeepingExpiredMessageCheckPeriod()
+    public long getHousekeepingCheckPeriod()
     {
-        return getLongValue("housekeeping.expiredMessageCheckPeriod", ApplicationRegistry.getInstance().getConfiguration().getHousekeepingCheckPeriod());
+        return getLongValue("housekeeping.checkPeriod", ApplicationRegistry.getInstance().getConfiguration().getHousekeepingCheckPeriod());
     }
 
     public String getAuthenticationDatabase()
@@ -313,6 +313,14 @@ public class VirtualHostConfiguration ex
                     + " It appears in virtual host definition : " + _name;
             throw new ConfigurationException(message);
         }
+
+        // QPID-3266.  Tidy up housekeeping configuration option for scheduling frequency
+        if (contains("housekeeping.expiredMessageCheckPeriod"))
+        {
+            String message = "Validation error : housekeeping/expiredMessageCheckPeriod must
be replaced by housekeeping/checkPeriod."
+                    + " It appears in virtual host definition : " + _name;
+            throw new ConfigurationException(message);
+        }
     }
 
     public int getHouseKeepingThreadCount()

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
(original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
Fri Aug 26 14:02:22 2011
@@ -239,19 +239,24 @@ public class VirtualHostImpl implements 
 
         _brokerMBean = new AMQBrokerManagerMBean(_virtualHostMBean);
         _brokerMBean.register();
-        initialiseHouseKeeping(hostConfig.getHousekeepingExpiredMessageCheckPeriod());
+        initialiseHouseKeeping(hostConfig.getHousekeepingCheckPeriod());
         
         initialiseStatistics();
     }
 
+    /**
+     * Initialise a housekeeping task to iterate over queues cleaning expired messages with
no consumers
+     * and checking for idle or open transactions that have exceeded the permitted thresholds.
+     *
+     * @param period
+     */
 	private void initialiseHouseKeeping(long period)
     {
-        /* add a timer task to iterate over queues, cleaning expired messages from queues
with no consumers */
         if (period != 0L)
         {
-            class ExpiredMessagesTask extends HouseKeepingTask
+            class VirtualHostHouseKeepingTask extends HouseKeepingTask
             {
-                public ExpiredMessagesTask(VirtualHost vhost)
+                public VirtualHostHouseKeepingTask(VirtualHost vhost)
                 {
                     super(vhost);
                 }
@@ -296,7 +301,7 @@ public class VirtualHostImpl implements 
                 }
             }
 
-            scheduleHouseKeepingTask(period, new ExpiredMessagesTask(this));
+            scheduleHouseKeepingTask(period, new VirtualHostHouseKeepingTask(this));
 
             Map<String, VirtualHostPluginFactory> plugins =
                 ApplicationRegistry.getInstance().getPluginManager().getVirtualHostPlugins();

Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
(original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
Fri Aug 26 14:02:22 2011
@@ -559,18 +559,17 @@ public class ServerConfigurationTest ext
         assertEquals(true, _serverConfig.getUseBiasedWrites());
     }
 
-    public void testGetHousekeepingExpiredMessageCheckPeriod() throws ConfigurationException
+    public void testGetHousekeepingCheckPeriod() throws ConfigurationException
     {
         // Check default
         _serverConfig.initialise();
         assertEquals(30000, _serverConfig.getHousekeepingCheckPeriod());
 
         // Check value we set
-        _config.setProperty("housekeeping.expiredMessageCheckPeriod", 23L);
+        _config.setProperty("housekeeping.checkPeriod", 23L);
         _serverConfig = new ServerConfiguration(_config);
         _serverConfig.initialise();
-        assertEquals(23, _serverConfig.getHousekeepingCheckPeriod());
-        _serverConfig.setHousekeepingExpiredMessageCheckPeriod(42L);
+        _serverConfig.setHousekeepingCheckPeriod(42L);
         assertEquals(42, _serverConfig.getHousekeepingCheckPeriod());
     }
 
@@ -1362,4 +1361,29 @@ public class ServerConfigurationTest ext
                     ce.getMessage());
         }
     }
+
+    /*
+     * Tests that the old element housekeeping.expiredMessageCheckPeriod. ... (that was
+     * replaced by housekeeping.checkPeriod) is rejected.
+     */
+    public void testExpiredMessageCheckPeriodRejected() throws ConfigurationException
+    {
+        _serverConfig.initialise();
+
+        // Check value we set
+        _config.setProperty("housekeeping.expiredMessageCheckPeriod", 23L);
+        _serverConfig = new ServerConfiguration(_config);
+
+        try
+        {
+            _serverConfig.initialise();
+            fail("Exception not thrown");
+        }
+        catch (ConfigurationException ce)
+        {
+            assertEquals("Incorrect error message",
+                    "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced
by housekeeping/checkPeriod.",
+                    ce.getMessage());
+        }
+    }
 }

Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
(original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/VirtualHostConfigurationTest.java
Fri Aug 26 14:02:22 2011
@@ -229,5 +229,26 @@ public class VirtualHostConfigurationTes
          }
      }
 
+     /*
+      * Tests that the old element housekeeping.expiredMessageCheckPeriod. ... (that was
+      * replaced by housekeeping.checkPeriod) is rejected.
+      */
+     public void testExpiredMessageCheckPeriodRejected() throws Exception
+     {
+         getConfigXml().addProperty("virtualhosts.virtualhost.testExpiredMessageCheckPeriodRejected.housekeeping.expiredMessageCheckPeriod",
+                 5);
 
+         try
+         {
+             super.createBroker();
+             fail("Exception not thrown");
+         }
+         catch (ConfigurationException ce)
+         {
+             assertEquals("Incorrect error message",
+                     "Validation error : housekeeping/expiredMessageCheckPeriod must be replaced
by housekeeping/checkPeriod." +
+                     " It appears in virtual host definition : " + getName(),
+                     ce.getMessage());
+         }
+     }
 }

Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
(original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueAlertTest.java
Fri Aug 26 14:02:22 2011
@@ -289,7 +289,7 @@ public class AMQQueueAlertTest extends I
     protected void configure()
     {
         // Increase Alert Check period
-        getConfiguration().setHousekeepingExpiredMessageCheckPeriod(200);
+        getConfiguration().setHousekeepingCheckPeriod(200);
     }
 
     private void sendMessages(AMQChannel channel, long messageCount, final long size) throws
AMQException

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/logging/AlertingTest.java
Fri Aug 26 14:02:22 2011
@@ -46,7 +46,7 @@ public class AlertingTest extends Abstra
     {
         // Update the configuration to make our virtualhost Persistent.
         makeVirtualHostPersistent(VIRTUALHOST);
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod",
"5000");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod",
"5000");
 
         _numMessages = 50;
 

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutConfigurationTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutConfigurationTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutConfigurationTest.java
Fri Aug 26 14:02:22 2011
@@ -31,7 +31,7 @@ public class TransactionTimeoutConfigura
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod",
"100");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod",
"100");
         
         // Set transaction timout properties.
         setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".transactionTimeout.openWarn",
"200");

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutDisabledTest.java
Fri Aug 26 14:02:22 2011
@@ -29,7 +29,7 @@ public class TransactionTimeoutDisabledT
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod",
"100");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod",
"100");
     }
 
     public void testProducerIdleCommit() throws Exception

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java?rev=1162121&r1=1162120&r2=1162121&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
Fri Aug 26 14:02:22 2011
@@ -72,7 +72,7 @@ public class TransactionTimeoutTestCase 
     protected void configure() throws Exception
     {
         // Setup housekeeping every second
-        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.expiredMessageCheckPeriod",
"100");
+        setConfigurationProperty("virtualhosts.virtualhost." + VIRTUALHOST + ".housekeeping.checkPeriod",
"100");
         
         /*
          * Set transaction timout properties. The XML in the virtualhosts configuration is
as follows:



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message