Author: clebert.suconic(a)jboss.com
Date: 2011-01-28 17:43:41 -0500 (Fri, 28 Jan 2011)
New Revision: 10157
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.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/server/management/JMSServerControlTest.java
Log:
HORNETQ-616 / HORNETQ-617 - settings of connection factories through management
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-01-28
09:22:51 UTC (rev 10156)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-01-28
22:43:41 UTC (rev 10157)
@@ -523,7 +523,7 @@
try
{
- boolean destroyed = server.removeConnectionFactoryFromJNDI(name);
+ boolean destroyed = server.destroyConnectionFactory(name);
if (destroyed)
{
sendNotification(NotificationType.CONNECTION_FACTORY_DESTROYED, name);
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-28
09:22:51 UTC (rev 10156)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2011-01-28
22:43:41 UTC (rev 10157)
@@ -279,7 +279,7 @@
for (String connectionFactory : new
HashSet<String>(connectionFactories.keySet()))
{
- destroyConnectionFactory(connectionFactory);
+ shutdownConnectionFactory(connectionFactory);
}
connectionFactories.clear();
@@ -1108,12 +1108,29 @@
public synchronized boolean destroyConnectionFactory(final String name) throws
Exception
{
+ if (!shutdownConnectionFactory(name))
+ {
+ return false;
+ }
+
+ storage.deleteConnectionFactory(name);
+
+ return true;
+ }
+
+ /**
+ * @param name
+ * @throws Exception
+ */
+ protected boolean shutdownConnectionFactory(final String name) throws Exception
+ {
checkInitialised();
List<String> jndiBindings = connectionFactoryJNDI.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
{
return false;
}
+
if (registry != null)
{
for (String jndiBinding : jndiBindings)
@@ -1126,7 +1143,7 @@
connectionFactories.remove(name);
jmsManagementService.unregisterConnectionFactory(name);
-
+
return true;
}
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2011-01-28
09:22:51 UTC (rev 10156)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2011-01-28
22:43:41 UTC (rev 10157)
@@ -29,6 +29,7 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.XASession;
+import javax.naming.NamingException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
@@ -42,6 +43,7 @@
import org.hornetq.api.core.management.ResourceNames;
import org.hornetq.api.jms.management.JMSServerControl;
import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.QueueBinding;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
@@ -480,7 +482,7 @@
});
}
- public void testCreateConnectionFactory_CopmleteList() throws Exception
+ public void testCreateConnectionFactory_CompleteList() throws Exception
{
JMSServerControl control = createManagementControl();
control.createConnectionFactory("test", //name
@@ -553,6 +555,8 @@
stopServer();
startServer();
+
+ control = createManagementControl();
cf = (HornetQQueueConnectionFactory)context.lookup("tst");
@@ -585,6 +589,27 @@
assertEquals(true, cf.isFailoverOnInitialConnection());
assertEquals("tst", cf.getGroupID());
+ control.destroyConnectionFactory("test");
+
+ ObjectNameBuilder nameBuilder =
ObjectNameBuilder.create(ConfigurationImpl.DEFAULT_JMX_DOMAIN);
+
assertFalse(mbeanServer.isRegistered(nameBuilder.getConnectionFactoryObjectName("test")));
+
+ stopServer();
+
+ startServer();
+
+
assertFalse(mbeanServer.isRegistered(nameBuilder.getConnectionFactoryObjectName("test")));
+
+
+ try
+ {
+ cf = (HornetQQueueConnectionFactory)context.lookup("tst");
+ fail("Failure expected");
+ }
+ catch (NamingException e)
+ {
+ }
+
}
Show replies by date