[hornetq-commits] JBoss hornetq SVN: r10135 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/server/impl and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Jan 22 20:38:06 EST 2011
Author: clebert.suconic at jboss.com
Date: 2011-01-22 20:38:06 -0500 (Sat, 22 Jan 2011)
New Revision: 10135
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/registry/JndiBindingRegistry.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
Log:
HORNETQ-624 / JBPAPP-5801 - avoid duplicates on JNDI through addJNDI
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/registry/JndiBindingRegistry.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/registry/JndiBindingRegistry.java 2011-01-23 01:07:57 UTC (rev 10134)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/registry/JndiBindingRegistry.java 2011-01-23 01:38:06 UTC (rev 10135)
@@ -55,7 +55,7 @@
}
catch (NamingException e)
{
- throw new RuntimeException(e);
+ return null;
}
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-01-23 01:07:57 UTC (rev 10134)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-01-23 01:38:06 UTC (rev 10135)
@@ -526,6 +526,10 @@
{
throw new IllegalArgumentException("Factory does not exist");
}
+ if (registry.lookup(jndiBinding) != null)
+ {
+ throw new HornetQException(HornetQException.ADDRESS_EXISTS, "JNDI " + name + " is already being used by another connection factory");
+ }
boolean added = bindToJndi(jndiBinding, factory);
if (added)
{
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2011-01-23 01:07:57 UTC (rev 10134)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2011-01-23 01:38:06 UTC (rev 10135)
@@ -25,6 +25,7 @@
import javax.jms.Session;
import javax.naming.NamingException;
+import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
import org.hornetq.tests.util.JMSTestBase;
@@ -71,7 +72,18 @@
jmsServer.createConnectionFactory(false, nonPersisted, "/nonPersisted" );
+
+
+ try
+ {
+ jmsServer.addConnectionFactoryToJNDI("np", "/someCF");
+ fail("Failure expected and the API let duplicates");
+ }
+ catch (HornetQException expected)
+ {
+ }
+
openCon("/someCF");
openCon("/someCF2");
openCon("/nonPersisted");
@@ -89,6 +101,14 @@
jmsServer.start();
jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI");
+ try
+ {
+ jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI");
+ fail("Failure expected and the API let duplicates");
+ }
+ catch (HornetQException expected)
+ {
+ }
openCon("/someCF");
openCon("/someCF2");
openCon("/newJNDI");
More information about the hornetq-commits
mailing list