[jboss-cvs] JBoss Messaging SVN: r4157 - in trunk: docs/examples/jms/etc and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 7 10:46:16 EDT 2008
Author: ataylor
Date: 2008-05-07 10:46:16 -0400 (Wed, 07 May 2008)
New Revision: 4157
Added:
trunk/docs/examples/jms/etc/log4j.xml
trunk/docs/examples/jms/src/org/jboss/jms/example/PerfExample.java
trunk/docs/examples/jms/src/org/jboss/jms/util/
trunk/docs/examples/jms/src/org/jboss/jms/util/PerfParams.java
Modified:
trunk/docs/examples/jms/build.xml
trunk/docs/userguide/en/master.xml
trunk/src/etc/jbm-jndi.xml
trunk/src/etc/queues.xml
trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java
trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/settings/impl/HierarchicalObjectRepository.java
trunk/src/main/org/jboss/messaging/core/settings/impl/QueueSettings.java
trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/QueueSettingsTest.java
Log:
added multi phase startup for DeploymentManager to allow services to be started in order. also chaned queue to use SimpleString for the DLQ and ExpiryQueue, this is to remove a 2 way dependancy on startup. also added a performance example.
Modified: trunk/docs/examples/jms/build.xml
===================================================================
--- trunk/docs/examples/jms/build.xml 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/docs/examples/jms/build.xml 2008-05-07 14:46:16 UTC (rev 4157)
@@ -40,6 +40,10 @@
<property name="etc.dir" value="etc"/>
<property name="build.dir" value="build"/>
+ <!--perf props-->
+ <property name="message.count" value="10000"/>
+ <property name="delivery.mode" value="NON_PERSISTENT"/>
+
<path id="compile.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
@@ -86,4 +90,20 @@
<classpath refid="runtime.classpath"/>
</java>
</target>
+
+ <target name="perfListener" depends="compile">
+ <java classname="org.jboss.jms.example.PerfExample" fork="true">
+ <classpath refid="runtime.classpath"/>
+ <arg value="-l"/>
+ </java>
+ </target>
+
+ <target name="perfSender" depends="compile">
+ <java classname="org.jboss.jms.example.PerfExample" fork="true">
+ <classpath refid="runtime.classpath"/>
+ <arg value="-s"/>
+ <arg value="${message.count}"/>
+ <arg value="${delivery.mode}"/>
+ </java>
+ </target>
</project>
\ No newline at end of file
Added: trunk/docs/examples/jms/etc/log4j.xml
===================================================================
--- trunk/docs/examples/jms/etc/log4j.xml (rev 0)
+++ trunk/docs/examples/jms/etc/log4j.xml 2008-05-07 14:46:16 UTC (rev 4157)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/docs/examples/jms/src/org/jboss/jms/example/PerfExample.java
===================================================================
--- trunk/docs/examples/jms/src/org/jboss/jms/example/PerfExample.java (rev 0)
+++ trunk/docs/examples/jms/src/org/jboss/jms/example/PerfExample.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.example;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.jms.util.PerfParams;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.*;
+import java.util.concurrent.*;
+
+/**
+ * a performance example that can be used to gather simple performance figures.
+ *
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class PerfExample
+{
+ private static Logger log = Logger.getLogger(PerfExample.class);
+ private Queue queue;
+ private Connection connection;
+ private int messageCount = 0;
+ private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+ private Session session;
+ private Sampler command = new Sampler();
+
+ public static void main(String[] args)
+ {
+ PerfExample perfExample = new PerfExample();
+ if (args[0].equalsIgnoreCase("-l"))
+ {
+ perfExample.runListener();
+ }
+ else
+ {
+ int noOfMessages = Integer.parseInt(args[1]);
+ int deliveryMode = args[2].equalsIgnoreCase("persistent")? DeliveryMode.PERSISTENT: DeliveryMode.NON_PERSISTENT;
+ perfExample.runSender(noOfMessages, deliveryMode);
+ }
+
+ }
+
+ private void init()
+ throws NamingException, JMSException
+ {
+ InitialContext initialContext = new InitialContext();
+ queue = (Queue) initialContext.lookup("/queue/testPerfQueue");
+ ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+ connection = cf.createConnection();
+ session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
+
+ public void runSender(int noOfMessage, int deliveryMode)
+ {
+ try
+ {
+ init();
+ MessageProducer producer = session.createProducer(queue);
+ producer.setDeliveryMode(deliveryMode);
+ ObjectMessage m = session.createObjectMessage();
+ PerfParams perfParams = new PerfParams();
+ perfParams.setNoOfMessagesToSend(noOfMessage);
+ perfParams.setDeliveryMode(deliveryMode);
+ m.setObject(perfParams);
+ producer.send(m);
+ scheduler.scheduleAtFixedRate(command, perfParams.getSamplePeriod(), perfParams.getSamplePeriod(), TimeUnit.MILLISECONDS);
+ for (int i = 1; i <= noOfMessage; i++)
+ {
+ TextMessage textMessage = session.createTextMessage("" + i);
+ producer.send(textMessage);
+ messageCount++;
+ }
+ scheduler.shutdownNow();
+ log.info("average " + command.getAverage() + " per " + (perfParams.getSamplePeriod()/1000) + " secs" );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (connection != null)
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void runListener()
+ {
+ try
+ {
+ init();
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ CountDownLatch countDownLatch = new CountDownLatch(1);
+ connection.start();
+ log.info("emptying queue");
+ while (true)
+ {
+ Message m = messageConsumer.receive(500);
+ if (m == null)
+ {
+ break;
+ }
+ }
+ messageConsumer.setMessageListener(new PerfListener(countDownLatch));
+ log.info("READY!!!");
+ countDownLatch.await();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (connection != null)
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+
+ /**
+ * a message listener
+ */
+ class PerfListener implements MessageListener
+ {
+ private boolean started = false;
+ private PerfParams params = null;
+ int count = 0;
+ private CountDownLatch countDownLatch;
+
+
+ public PerfListener(CountDownLatch countDownLatch)
+ {
+ this.countDownLatch = countDownLatch;
+ }
+
+ public void onMessage(Message message)
+ {
+ if (!started)
+ {
+ started = true;
+ ObjectMessage m = (ObjectMessage) message;
+ try
+ {
+ params = (PerfParams) m.getObject();
+ }
+ catch (JMSException e)
+ {
+ params = new PerfParams();
+ }
+ log.info("params = " + params);
+ scheduler.scheduleAtFixedRate(command, params.getSamplePeriod(), params.getSamplePeriod(), TimeUnit.MILLISECONDS);
+ }
+ else
+ {
+ try
+ {
+ TextMessage m = (TextMessage) message;
+ messageCount++;
+ int count = Integer.parseInt(m.getText());
+ if (count == params.getNoOfMessagesToSend())
+ {
+ countDownLatch.countDown();
+ /* try
+ {
+ Thread.sleep(params.getSamplePeriod());
+ }
+ catch (InterruptedException e)
+ {
+ //ignore
+ }*/
+ scheduler.shutdownNow();
+ log.info("average " + command.getAverage() + " per " + (params.getSamplePeriod()/1000) + " secs" );
+ }
+ }
+ catch (JMSException e)
+ {
+ log.info(e);
+ countDownLatch.countDown();
+ scheduler.shutdownNow();
+ }
+ }
+ }
+ }
+
+ /**
+ * simple class to gather performance figures
+ */
+ class Sampler implements Runnable
+ {
+ int sampleCount = 0;
+
+ long startTime = 0;
+
+ long samplesTaken = 0;
+
+ public void run()
+ {
+ if(startTime == 0)
+ {
+ startTime = System.currentTimeMillis();
+ }
+ long elapsed = System.currentTimeMillis() - startTime;
+ int lastCount = sampleCount;
+ sampleCount = messageCount;
+ samplesTaken++;
+ log.info(" time elapsed " + (elapsed / 1000) + " secs, message count " + (sampleCount) + " : this period " + (sampleCount - lastCount));
+ }
+
+ public long getAverage()
+ {
+ return sampleCount/samplesTaken;
+ }
+
+ }
+}
Added: trunk/docs/examples/jms/src/org/jboss/jms/util/PerfParams.java
===================================================================
--- trunk/docs/examples/jms/src/org/jboss/jms/util/PerfParams.java (rev 0)
+++ trunk/docs/examples/jms/src/org/jboss/jms/util/PerfParams.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.util;
+
+import javax.jms.DeliveryMode;
+import java.io.Serializable;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+*/
+public class PerfParams implements Serializable
+{
+ int noOfMessagesToSend = 1000;
+ long samplePeriod = 1000;
+ int deliveryMode = DeliveryMode.NON_PERSISTENT;
+
+ public int getNoOfMessagesToSend()
+ {
+ return noOfMessagesToSend;
+ }
+
+ public void setNoOfMessagesToSend(int noOfMessagesToSend)
+ {
+ this.noOfMessagesToSend = noOfMessagesToSend;
+ }
+
+ public long getSamplePeriod()
+ {
+ return samplePeriod;
+ }
+
+ public void setSamplePeriod(long samplePeriod)
+ {
+ this.samplePeriod = samplePeriod;
+ }
+
+ public int getDeliveryMode()
+ {
+ return deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode)
+ {
+ this.deliveryMode = deliveryMode;
+ }
+
+ public String toString()
+ {
+ return "message to send = " + noOfMessagesToSend + " samplePeriod = " + samplePeriod + "ms" + " DeliveryMode = " +
+ (deliveryMode == DeliveryMode.PERSISTENT?"PERSISTENT":"NON_PERSISTENT");
+ }
+}
Modified: trunk/docs/userguide/en/master.xml
===================================================================
--- trunk/docs/userguide/en/master.xml 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/docs/userguide/en/master.xml 2008-05-07 14:46:16 UTC (rev 4157)
@@ -13,7 +13,7 @@
]>
<book lang="en">
<bookinfo>
- <title>JBoss Messaging 1.4 User's Guide</title>
+ <title>JBoss Messaging 2.0 User's Guide</title>
<subtitle>Enterprise Messaging from JBoss</subtitle>
Modified: trunk/src/etc/jbm-jndi.xml
===================================================================
--- trunk/src/etc/jbm-jndi.xml 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/etc/jbm-jndi.xml 2008-05-07 14:46:16 UTC (rev 4157)
@@ -66,6 +66,9 @@
<queue name="testQueue">
<entry name="/queue/testQueue"/>
</queue>
+ <queue name="testPerfQueue">
+ <entry name="/queue/testPerfQueue"/>
+ </queue>
<queue name="A">
<entry name="/queue/A"/>
</queue>
Modified: trunk/src/etc/queues.xml
===================================================================
--- trunk/src/etc/queues.xml 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/etc/queues.xml 2008-05-07 14:46:16 UTC (rev 4157)
@@ -89,6 +89,10 @@
<clustered>true</clustered>
</queue-settings>
+ <queue-settings match="queuejms.testPerfQueue">
+ <clustered>false</clustered>
+ </queue-settings>
+
<!--default for catch all-->
<queue-settings match="*">
<clustered>false</clustered>
Modified: trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/Deployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -70,4 +70,10 @@
* @throws Exception .
*/
void undeploy(URL url) throws Exception;
+
+ /**
+ * the weight of the deployer, used for ordering the order that deployers are deployed.
+ * @return
+ */
+ int getWeight();
}
\ No newline at end of file
Modified: trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/DeploymentManager.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -28,7 +28,7 @@
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
*/
-public interface DeploymentManager extends MessagingComponent
+public interface DeploymentManager
{
/**
* registers a deployable object which will handle the deployment of URL's
@@ -36,7 +36,7 @@
* @param deployer The deployable object
* @throws Exception .
*/
- public void registerDeployer(Deployer deployer) throws Exception;
+ void registerDeployer(Deployer deployer) throws Exception;
/**
* unregisters a deployable object which will handle the deployment of URL's
@@ -44,5 +44,9 @@
* @param deployer The deployable object
* @throws Exception .
*/
- public void unregisterDeployer(Deployer deployer);
+ void unregisterDeployer(Deployer deployer);
+
+ void start(int weight) throws Exception;
+
+ void stop();
}
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/FileDeploymentManager.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -40,7 +40,7 @@
{
private static final Logger log = Logger.getLogger(FileDeploymentManager.class);
//these are the list of deployers, typically destination and connection factory.
- private static ArrayList<Deployer> Deployers = new ArrayList<Deployer>();
+ private static ArrayList<Deployer> deployers = new ArrayList<Deployer>();
//any config files deployed and the time they were deployed
private static HashMap<URL, Long> deployed = new HashMap<URL, Long>();
// the list of URL's to deploy
@@ -51,35 +51,39 @@
private static ArrayList<URL> toRedeploy = new ArrayList<URL>();
private static ScheduledExecutorService scheduler;
+ int currentWeight = 0;
- public void start() throws Exception
+ public void start(int weight) throws Exception
{
- Collection<ConfigurationURL> configurations = getConfigurations();
- for (ConfigurationURL configuration : configurations)
+
+ Collection<ConfigurationURL> configurations = getUnstartedConfigurations(weight);
+ for (ConfigurationURL configuration : configurations)
+ {
+ Iterator<URL> urls = configuration.getUrls();
+ while (urls.hasNext())
{
- Iterator<URL> urls = configuration.getUrls();
- while (urls.hasNext())
- {
- URL url = urls.next();
- log.info(new StringBuilder("adding url ").append(url).append(" to be deployed"));
- deployed.put(url, new File(url.getFile()).lastModified());
- }
+ URL url = urls.next();
+ log.info(new StringBuilder("adding url ").append(url).append(" to be deployed"));
+ deployed.put(url, new File(url.getFile()).lastModified());
}
+ }
+ currentWeight = weight;
+ // Get the scheduler
+ scheduler = Executors.newSingleThreadScheduledExecutor();
- // Get the scheduler
- scheduler = Executors.newSingleThreadScheduledExecutor();
-
- scheduler.scheduleAtFixedRate(this, 10, 5, TimeUnit.SECONDS);
+ scheduler.scheduleAtFixedRate(this, 10, 5, TimeUnit.SECONDS);
}
public void stop()
{
+ deployers.clear();
if (scheduler != null)
- {
- scheduler.shutdown();
- scheduler = null;
- }
+ {
+ scheduler.shutdown();
+ scheduler = null;
+ }
}
+
/**
* registers a Deployer object which will handle the deployment of URL's
*
@@ -90,33 +94,36 @@
{
synchronized (this)
{
- Deployers.add(Deployer);
- Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
- while (urls.hasMoreElements())
+ deployers.add(Deployer);
+ if (Deployer.getWeight() <= currentWeight)
{
- URL url = urls.nextElement();
- if (!deployed.keySet().contains(url))
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
+ while (urls.hasMoreElements())
{
- deployed.put(url, new File(url.getFile()).lastModified());
- }
- try
- {
- log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
- Deployer.deploy(url);
+ URL url = urls.nextElement();
+ if (!deployed.keySet().contains(url))
+ {
+ deployed.put(url, new File(url.getFile()).lastModified());
+ }
+ try
+ {
+ log.info(new StringBuilder("Deploying ").append(Deployer).append(" with url").append(url));
+ Deployer.deploy(url);
+ }
+ catch (Exception e)
+ {
+ log.error(new StringBuilder("Error deploying ").append(url), e);
+ }
}
- catch (Exception e)
- {
- log.error(new StringBuilder("Error deploying ").append(url), e);
- }
}
}
}
public void unregisterDeployer(Deployer Deployer)
{
- Deployers.remove(Deployer);
- if(Deployers.size() == 0)
+ deployers.remove(Deployer);
+ if (deployers.size() == 0)
{
if (scheduler != null)
{
@@ -125,6 +132,7 @@
}
}
}
+
/**
* called by the ExecutorService every n seconds
*/
@@ -149,27 +157,53 @@
* @return a set of configurationUrls
* @throws java.io.IOException .
*/
- private static Collection<ConfigurationURL> getConfigurations() throws IOException
+ private Collection<ConfigurationURL> getUnstartedConfigurations(int weight) throws IOException
{
HashMap<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
- for (Deployer Deployer : Deployers)
+ for (Deployer deployer : deployers)
{
- Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(Deployer.getConfigFileName());
+ if (deployer.getWeight() <= weight && deployer.getWeight() > currentWeight)
+ {
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
- if(!configurations.keySet().contains(Deployer.getConfigFileName()))
- {
- ConfigurationURL conf = new ConfigurationURL(urls, Deployer.getConfigFileName());
- configurations.put(Deployer.getConfigFileName(), conf);
+ if (!configurations.keySet().contains(deployer.getConfigFileName()))
+ {
+ ConfigurationURL conf = new ConfigurationURL(urls, deployer.getConfigFileName());
+ configurations.put(deployer.getConfigFileName(), conf);
+ }
+ else
+ {
+ configurations.get(deployer.getConfigFileName()).add(urls);
+ }
}
- else
- {
- configurations.get(Deployer.getConfigFileName()).add(urls);
- }
}
return configurations.values();
}
+ private Collection<ConfigurationURL> getStartedConfigurations() throws IOException
+ {
+ HashMap<String, ConfigurationURL> configurations = new HashMap<String, ConfigurationURL>();
+ for (Deployer deployer : deployers)
+ {
+ if (deployer.getWeight() <= currentWeight)
+ {
+ Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(deployer.getConfigFileName());
+ if (!configurations.keySet().contains(deployer.getConfigFileName()))
+ {
+ ConfigurationURL conf = new ConfigurationURL(urls, deployer.getConfigFileName());
+ configurations.put(deployer.getConfigFileName(), conf);
+ }
+ else
+ {
+ configurations.get(deployer.getConfigFileName()).add(urls);
+ }
+ }
+ }
+ return configurations.values();
+ }
+
+
/**
* scans for changes to any of the configuration files registered
*
@@ -177,7 +211,7 @@
*/
private void scan() throws Exception
{
- Collection<ConfigurationURL> configurations = getConfigurations();
+ Collection<ConfigurationURL> configurations = getStartedConfigurations();
for (ConfigurationURL configuration : configurations)
{
Iterator<URL> urls = configuration.getUrls();
@@ -224,13 +258,14 @@
/**
* undeploys a url, delegates to appropiate registered Deployers
+ *
* @param url the url to undeploy
*/
private void undeploy(URL url)
{
deployed.remove(url);
- for (Deployer Deployer : Deployers)
+ for (Deployer Deployer : deployers)
{
try
{
@@ -244,14 +279,15 @@
}
}
- /**
+ /**
* redeploys a url, delegates to appropiate registered Deployers
+ *
* @param url the url to redeploy
*/
private void redeploy(URL url)
{
deployed.put(url, new File(url.getFile()).lastModified());
- for (Deployer Deployer : Deployers)
+ for (Deployer Deployer : deployers)
{
try
{
@@ -265,8 +301,9 @@
}
}
- /**
+ /**
* deploys a url, delegates to appropiate registered Deployers
+ *
* @param url the url to deploy
* @throws Exception .
*/
@@ -274,7 +311,7 @@
throws Exception
{
deployed.put(url, new File(url.getFile()).lastModified());
- for (Deployer Deployer : Deployers)
+ for (Deployer Deployer : deployers)
{
try
{
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/QueueSettingsDeployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -49,13 +49,9 @@
private static final String MESSAGE_COUNTER_HISTORY_DAY_LIMIT_NODE_NAME = "message-counter-history-day-limit";
private final HierarchicalRepository<QueueSettings> queueSettingsRepository;
-
- private final PostOffice postOffice;
- public QueueSettingsDeployer(final PostOffice postOffice, final HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ public QueueSettingsDeployer(final HierarchicalRepository<QueueSettings> queueSettingsRepository)
{
- this.postOffice = postOffice;
-
this.queueSettingsRepository = queueSettingsRepository;
}
@@ -92,24 +88,12 @@
else if (DLQ_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
{
SimpleString queueName = new SimpleString(child.getTextContent());
-
- if (postOffice.getBinding(queueName) == null)
- {
- postOffice.addBinding(queueName, queueName, null, true, false);
- }
-
- queueSettings.setDLQ(postOffice.getBinding(queueName).getQueue());
+ queueSettings.setDLQ(queueName);
}
else if (EXPIRY_QUEUE_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
{
SimpleString queueName = new SimpleString(child.getTextContent());
-
- if (postOffice.getBinding(queueName) == null)
- {
- postOffice.addBinding(queueName, queueName, null, true, false);
- }
-
- queueSettings.setExpiryQueue(postOffice.getBinding(queueName).getQueue());
+ queueSettings.setExpiryQueue(queueName);
}
else if (REDELIVERY_DELAY_NODE_NAME.equalsIgnoreCase(child.getNodeName()))
{
@@ -142,6 +126,11 @@
return "queues.xml";
}
+ public int getWeight()
+ {
+ return 1;
+ }
+
/**
* undeploys an element
* @param node the element to undeploy
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityDeployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -142,4 +142,9 @@
{
return QUEUES_XML;
}
+
+ public int getWeight()
+ {
+ return 1;
+ }
}
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/SecurityManagerDeployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -75,6 +75,11 @@
return "jbm-security.xml";
}
+ public int getWeight()
+ {
+ return 1;
+ }
+
public void setJbmSecurityManager(JBMUpdateableSecurityManager jbmSecurityManager)
{
this.jbmSecurityManager = jbmSecurityManager;
Modified: trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/deployers/impl/XmlDeployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -230,8 +230,8 @@
throws Exception;
+ abstract public int getWeight();
-
protected Element getRootElement(URL url)
throws Exception
{
Modified: trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/message/impl/MessageReferenceImpl.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -32,6 +32,7 @@
import org.jboss.messaging.core.settings.impl.QueueSettings;
import org.jboss.messaging.core.transaction.Transaction;
import org.jboss.messaging.core.transaction.impl.TransactionImpl;
+import org.jboss.messaging.util.SimpleString;
/**
* Implementation of a MessageReference
@@ -136,18 +137,18 @@
int maxDeliveries = queueSettingsRepository.getMatch(queue.getName().toString()).getMaxDeliveryAttempts();
if (maxDeliveries > 0 && deliveryCount >= maxDeliveries)
- {
- Queue DLQ = queueSettingsRepository.getMatch(queue.getName().toString()).getDLQ();
+ {
+ SimpleString DLQ = queueSettingsRepository.getMatch(queue.getName().toString()).getDLQ();
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
if (DLQ != null)
{
- Binding binding = postOffice.getBinding(DLQ.getName());
+ Binding binding = postOffice.getBinding(DLQ);
if (binding == null)
{
- throw new IllegalStateException("Cannot find binding for DLQ: " + DLQ.getName());
+ binding = postOffice.addBinding(DLQ, DLQ, null, true, false);
}
Message copyMessage = makeCopyForDLQOrExpiry(false, persistenceManager);
@@ -176,17 +177,17 @@
public void expire(final StorageManager persistenceManager, final PostOffice postOffice,
final HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception
{
- Queue expiryQueue = queueSettingsRepository.getMatch(queue.getName().toString()).getExpiryQueue();
+ SimpleString expiryQueue = queueSettingsRepository.getMatch(queue.getName().toString()).getExpiryQueue();
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
if (expiryQueue != null)
{
- Binding binding = postOffice.getBinding(expiryQueue.getName());
+ Binding binding = postOffice.getBinding(expiryQueue);
if (binding == null)
{
- throw new IllegalStateException("Cannot find binding for expiry queue: " + expiryQueue.getName());
+ binding = postOffice.addBinding(expiryQueue, expiryQueue, null, true, false);
}
Message copyMessage = makeCopyForDLQOrExpiry(false, persistenceManager);
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -164,7 +164,7 @@
connectionManager = new ConnectionManagerImpl();
memoryManager = new SimpleMemoryManager();
postOffice = new PostOfficeImpl(storageManager, queueFactory, configuration.isRequireDestinations());
- queueSettingsDeployer = new QueueSettingsDeployer(postOffice, queueSettingsRepository);
+ queueSettingsDeployer = new QueueSettingsDeployer(queueSettingsRepository);
if (createTransport)
{
@@ -174,11 +174,12 @@
securityDeployer.start();
remotingService.addRemotingSessionListener(connectionManager);
memoryManager.start();
- postOffice.start();
-
- deploymentManager.start();
+ deploymentManager.start(1);
deploymentManager.registerDeployer(securityDeployer);
deploymentManager.registerDeployer(queueSettingsDeployer);
+ postOffice.start();
+ deploymentManager.start(2);
+
MessagingServerPacketHandler serverPacketHandler = new MessagingServerPacketHandler(this);
getRemotingService().getDispatcher().register(serverPacketHandler);
Modified: trunk/src/main/org/jboss/messaging/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/settings/impl/HierarchicalObjectRepository.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/settings/impl/HierarchicalObjectRepository.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -121,6 +121,8 @@
if (actualMatch == null || !Mergeable.class.isAssignableFrom(actualMatch.getClass()))
{
actualMatch = match.getValue();
+ if(!Mergeable.class.isAssignableFrom(actualMatch.getClass()))
+ break;
}
else
{
@@ -223,23 +225,23 @@
{
if (o1.contains(Match.WILDCARD) && !o2.contains(Match.WILDCARD))
{
- return -1;
+ return +1;
}
else if (!o1.contains(Match.WILDCARD) && o2.contains(Match.WILDCARD))
{
- return +1;
+ return -1;
}
else if (o1.contains(Match.WILDCARD) && o2.contains(Match.WILDCARD))
{
- return o1.length() - o2.length();
+ return o2.length() - o1.length();
}
else if (o1.contains(Match.WORD_WILDCARD) && !o2.contains(Match.WORD_WILDCARD))
{
- return -1;
+ return +1;
}
else if (!o1.contains(Match.WORD_WILDCARD) && o2.contains(Match.WORD_WILDCARD))
{
- return +1;
+ return -1;
}
else if (o1.contains(Match.WORD_WILDCARD) && o2.contains(Match.WORD_WILDCARD))
{
@@ -252,11 +254,11 @@
{
if (rightSplits.length < i || !rightSplits[i].equals(Match.WORD_WILDCARD))
{
- return +1;
+ return -1;
}
else
{
- return -1;
+ return +1;
}
}
}
Modified: trunk/src/main/org/jboss/messaging/core/settings/impl/QueueSettings.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/settings/impl/QueueSettings.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/core/settings/impl/QueueSettings.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -26,6 +26,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.impl.RoundRobinDistributionPolicy;
import org.jboss.messaging.core.settings.Mergeable;
+import org.jboss.messaging.util.SimpleString;
/**
* The Queue Settings that will be used to configure a queue
@@ -46,14 +47,14 @@
public static final Long DEFAULT_REDELIVER_DELAY = (long) 500;
- private Boolean clustered = false;
+ private Boolean clustered = null;
private Integer maxSize = null;
private String distributionPolicyClass = null;
private Integer maxDeliveryAttempts = null;
private Integer messageCounterHistoryDayLimit = null;
private Long redeliveryDelay = null;
- private Queue DLQ = null;
- private Queue ExpiryQueue = null;
+ private SimpleString DLQ = null;
+ private SimpleString ExpiryQueue = null;
private Integer consumerWindowSize = null;
private Integer consumerMaxRate = null;
private Integer producerWindowSize = null;
@@ -120,22 +121,22 @@
this.distributionPolicyClass = distributionPolicyClass;
}
- public Queue getDLQ()
+ public SimpleString getDLQ()
{
return DLQ;
}
- public void setDLQ(Queue DLQ)
+ public void setDLQ(SimpleString DLQ)
{
this.DLQ = DLQ;
}
- public Queue getExpiryQueue()
+ public SimpleString getExpiryQueue()
{
return ExpiryQueue;
}
- public void setExpiryQueue(Queue expiryQueue)
+ public void setExpiryQueue(SimpleString expiryQueue)
{
ExpiryQueue = expiryQueue;
}
@@ -203,51 +204,51 @@
*/
public void merge(QueueSettings merged)
{
- if(!DEFAULT_CLUSTERED.equals(merged.clustered))
+ if(clustered == null)
{
clustered = merged.clustered;
}
- if(!DEFAULT_MAX_DELIVERY_ATTEMPTS.equals(merged.maxDeliveryAttempts) && merged.maxDeliveryAttempts != null)
+ if(maxDeliveryAttempts == null)
{
maxDeliveryAttempts = merged.maxDeliveryAttempts;
}
- if(!DEFAULT_MAX_SIZE.equals(merged.maxSize) && merged.maxSize != null)
+ if(maxSize == null)
{
maxSize = merged.maxSize;
}
- if(!DEFAULT_MESSAGE_COUNTER_HISTORY_DAY_LIMIT.equals(merged.messageCounterHistoryDayLimit) && merged.messageCounterHistoryDayLimit != null)
+ if(messageCounterHistoryDayLimit == null)
{
messageCounterHistoryDayLimit = merged.messageCounterHistoryDayLimit;
}
- if(!DEFAULT_REDELIVER_DELAY.equals(merged.redeliveryDelay) && merged.redeliveryDelay != null && merged.redeliveryDelay != null)
+ if(redeliveryDelay == null)
{
redeliveryDelay = merged.redeliveryDelay;
}
- if(merged.distributionPolicyClass != null)
+ if(distributionPolicyClass == null)
{
distributionPolicyClass = merged.distributionPolicyClass;
}
- if(merged.DLQ != null)
+ if(DLQ == null)
{
DLQ = merged.DLQ;
}
- if(merged.ExpiryQueue != null)
+ if(ExpiryQueue == null)
{
ExpiryQueue = merged.ExpiryQueue;
}
- if (merged.consumerWindowSize != null)
+ if (consumerWindowSize == null)
{
consumerWindowSize = merged.consumerWindowSize;
}
- if (merged.consumerMaxRate != null)
+ if (consumerMaxRate == null)
{
consumerMaxRate = merged.consumerMaxRate;
}
- if (merged.producerWindowSize != null)
+ if (producerWindowSize == null)
{
producerWindowSize = merged.producerWindowSize;
}
- if (merged.producerMaxRate != null)
+ if (producerMaxRate == null)
{
producerMaxRate = merged.producerMaxRate;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -260,4 +260,9 @@
return "jbm-jndi.xml";
}
+ public int getWeight()
+ {
+ return 2;
+ }
+
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/DeployerTest.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -240,5 +240,10 @@
{
return element;
}
+
+ public int getWeight()
+ {
+ return 0;
+ }
}
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/deployers/impl/QueueSettingsDeployerTest.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -31,8 +31,8 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.util.SimpleString;
import org.jboss.messaging.util.XMLUtil;
+import org.jboss.messaging.util.SimpleString;
/**
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
@@ -41,7 +41,7 @@
{
private String conf = "<queue-settings match=\"queues.*\">\n" +
" <clustered>false</clustered>\n" +
- " <dlq>DLQTest</dlq>\n" +
+ " <dlq>DLQtest</dlq>\n" +
" <expiry-queue>ExpiryQueueTest</expiry-queue>\n" +
" <redelivery-delay>100</redelivery-delay>\n" +
" <max-size>-100</max-size>\n" +
@@ -52,15 +52,12 @@
private QueueSettingsDeployer queueSettingsDeployer;
private HierarchicalRepository<QueueSettings> repository;
- private PostOffice postOffice;
protected void setUp() throws Exception
{
- postOffice = EasyMock.createMock(PostOffice.class);
-
repository = EasyMock.createStrictMock(HierarchicalRepository.class);
- queueSettingsDeployer = new QueueSettingsDeployer(postOffice, repository);
+ queueSettingsDeployer = new QueueSettingsDeployer(repository);
}
public void testDeploy() throws Exception
@@ -71,19 +68,9 @@
queueSettings.setMaxSize(-100);
queueSettings.setDistributionPolicyClass("org.jboss.messaging.core.impl.RoundRobinDistributionPolicy");
queueSettings.setMessageCounterHistoryDayLimit(1000);
- Queue mockDLQ = EasyMock.createMock(Queue.class);
- queueSettings.setDLQ(mockDLQ);
- SimpleString dlqTest = new SimpleString("DLQTest");
- EasyMock.expect(postOffice.getBinding(dlqTest)).andReturn(new BindingImpl(dlqTest, mockDLQ));
- EasyMock.expect(postOffice.getBinding(dlqTest)).andReturn(new BindingImpl(dlqTest, mockDLQ));
- Queue mockQ = EasyMock.createMock(Queue.class);
- queueSettings.setExpiryQueue(mockQ);
- SimpleString expiryQueueTest = new SimpleString("ExpiryQueueTest");
- EasyMock.expect(postOffice.getBinding(expiryQueueTest)).andReturn(new BindingImpl(expiryQueueTest, mockQ));
- EasyMock.expect(postOffice.getBinding(expiryQueueTest)).andReturn(new BindingImpl(expiryQueueTest, mockQ));
+ queueSettings.setDLQ(new SimpleString("DLQtest"));
+ queueSettings.setExpiryQueue(new SimpleString("ExpiryQueueTest"));
- EasyMock.replay(postOffice);
-
repository.addMatch(EasyMock.eq("queues.*"), settings(queueSettings));
EasyMock.replay(repository);
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/QueueSettingsTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/QueueSettingsTest.java 2008-05-07 06:59:22 UTC (rev 4156)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/settings/impl/QueueSettingsTest.java 2008-05-07 14:46:16 UTC (rev 4157)
@@ -22,9 +22,9 @@
package org.jboss.messaging.tests.unit.core.settings.impl;
import junit.framework.TestCase;
-
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.impl.QueueImpl;
+import org.jboss.messaging.core.server.impl.RoundRobinDistributionPolicy;
import org.jboss.messaging.core.settings.impl.QueueSettings;
import org.jboss.messaging.util.SimpleString;
@@ -53,8 +53,8 @@
QueueSettings queueSettings = new QueueSettings();
QueueSettings queueSettingsToMerge = new QueueSettings();
queueSettingsToMerge.setClustered(true);
- Queue DLQ = new QueueImpl(0,new SimpleString("testDLQ"), null, false, false, false, 0, null);
- Queue exp = new QueueImpl(0,new SimpleString("testExpiryQueue"), null, false, false, false, 0, null);
+ SimpleString DLQ = new SimpleString("testDLQ");
+ SimpleString exp = new SimpleString("testExpiryQueue");
queueSettingsToMerge.setDLQ(DLQ);
queueSettingsToMerge.setExpiryQueue(exp);
queueSettingsToMerge.setMaxDeliveryAttempts(1000);
@@ -78,19 +78,18 @@
QueueSettings queueSettings = new QueueSettings();
QueueSettings queueSettingsToMerge = new QueueSettings();
queueSettingsToMerge.setClustered(true);
- Queue DLQ = new QueueImpl(0,new SimpleString("testDLQ"), null, false, false, false, 0, null);
- Queue exp = new QueueImpl(0,new SimpleString("testExpiryQueue"), null, false, false, false, 0, null);
+ SimpleString DLQ = new SimpleString("testDLQ");
+ SimpleString exp = new SimpleString("testExpiryQueue");
queueSettingsToMerge.setDLQ(DLQ);
queueSettingsToMerge.setExpiryQueue(exp);
queueSettingsToMerge.setMaxDeliveryAttempts(1000);
queueSettingsToMerge.setMaxSize(1001);
queueSettingsToMerge.setMessageCounterHistoryDayLimit(1002);
- queueSettingsToMerge.setRedeliveryDelay((long)1003);
queueSettings.merge(queueSettingsToMerge);
QueueSettings queueSettingsToMerge2 = new QueueSettings();
queueSettingsToMerge2.setClustered(true);
- Queue exp2 = new QueueImpl(0,new SimpleString("testExpiryQueue2"), null, false, false, false, 0, null);
+ SimpleString exp2 = new SimpleString("testExpiryQueue2");
queueSettingsToMerge2.setExpiryQueue(exp2);
queueSettingsToMerge2.setMaxSize(2001);
queueSettingsToMerge2.setRedeliveryDelay((long)2003);
@@ -100,9 +99,9 @@
assertEquals(queueSettings.getDistributionPolicyClass(), null);
assertEquals(queueSettings.isClustered(), Boolean.valueOf(true));
assertEquals(queueSettings.getDLQ(), DLQ);
- assertEquals(queueSettings.getExpiryQueue(), exp2);
+ assertEquals(queueSettings.getExpiryQueue(), exp);
assertEquals(queueSettings.getMaxDeliveryAttempts(), Integer.valueOf(1000));
- assertEquals(queueSettings.getMaxSize(), Integer.valueOf(2001));
+ assertEquals(queueSettings.getMaxSize(), Integer.valueOf(1001));
assertEquals(queueSettings.getMessageCounterHistoryDayLimit(), Integer.valueOf(1002));
assertEquals(queueSettings.getRedeliveryDelay(), Long.valueOf(2003));
}
@@ -112,20 +111,18 @@
QueueSettings queueSettings = new QueueSettings();
QueueSettings queueSettingsToMerge = new QueueSettings();
queueSettingsToMerge.setClustered(true);
- Queue DLQ = new QueueImpl(0,new SimpleString("testDLQ"), null, false, false, false, 0, null);
- Queue exp = new QueueImpl(0,new SimpleString("testExpiryQueue"), null, false, false, false, 0, null);
+ SimpleString DLQ = new SimpleString("testDLQ");
+ SimpleString exp = new SimpleString("testExpiryQueue");
queueSettingsToMerge.setDLQ(DLQ);
queueSettingsToMerge.setExpiryQueue(exp);
- queueSettingsToMerge.setMaxDeliveryAttempts(1000);
queueSettingsToMerge.setMaxSize(1001);
- queueSettingsToMerge.setMessageCounterHistoryDayLimit(1002);
queueSettingsToMerge.setRedeliveryDelay((long)1003);
queueSettings.merge(queueSettingsToMerge);
QueueSettings queueSettingsToMerge2 = new QueueSettings();
queueSettingsToMerge2.setClustered(false);
- Queue exp2 = new QueueImpl(0,new SimpleString("testExpiryQueue2"), null, false, false, false, 0, null);
- Queue DLQ2 = new QueueImpl(0,new SimpleString("testDlq2"), null, false, false, false, 0, null);
+ SimpleString exp2 = new SimpleString("testExpiryQueue2");
+ SimpleString DLQ2 = new SimpleString("testDlq2");
queueSettingsToMerge2.setExpiryQueue(exp2);
queueSettingsToMerge2.setDLQ(DLQ2);
queueSettingsToMerge2.setMaxDeliveryAttempts(2000);
@@ -137,11 +134,11 @@
assertEquals(queueSettings.getDistributionPolicy().getClass(), QueueSettings.DEFAULT_DISTRIBUTION_POLICY.getClass());
assertEquals(queueSettings.getDistributionPolicyClass(), null);
assertEquals(queueSettings.isClustered(), Boolean.valueOf(true));
- assertEquals(queueSettings.getDLQ(), DLQ2);
- assertEquals(queueSettings.getExpiryQueue(), exp2);
+ assertEquals(queueSettings.getDLQ(), DLQ);
+ assertEquals(queueSettings.getExpiryQueue(), exp);
assertEquals(queueSettings.getMaxDeliveryAttempts(), Integer.valueOf(2000));
- assertEquals(queueSettings.getMaxSize(), Integer.valueOf(2001));
+ assertEquals(queueSettings.getMaxSize(), Integer.valueOf(1001));
assertEquals(queueSettings.getMessageCounterHistoryDayLimit(), Integer.valueOf(2002));
- assertEquals(queueSettings.getRedeliveryDelay(), Long.valueOf(2003));
+ assertEquals(queueSettings.getRedeliveryDelay(), Long.valueOf(1003));
}
}
More information about the jboss-cvs-commits
mailing list