diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index ed751ac276d..115f194a6a9 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -1481,100 +1481,6 @@ private void correctInvalidNettyConnectorHost(TransportConfiguration transportCo } } - /** - * This class is responsible for auto-creating the JMS (and underlying core) resources when a client sends a message - * to a non-existent JMS queue or topic - */ -// class JMSDestinationCreator implements QueueCreator { -// -// @Override -// public boolean create(SimpleString address) throws Exception { -// AddressSettings settings = server.getAddressSettingsRepository().getMatch(address.toString()); -// if (address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && settings.isAutoCreateQueues()) { -// return internalCreateJMSQueue(false, address.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()), null, true, true); -// } else if (address.toString().startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX) && settings.isAutoCreateAddresses()) { -// return createTopic(false, address.toString().substring(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX.length()), true); -// } else { -// return false; -// } -// } -// } - -// class JMSQueueDeleter implements QueueDeleter { -// -// @Override -// public boolean delete(SimpleString queueName) throws Exception { -// Queue queue = server.locateQueue(queueName); -// SimpleString address = queue.getAddress(); -// AddressSettings settings = server.getAddressSettingsRepository().getMatch(address.toString()); -// long consumerCount = queue.getConsumerCount(); -// long messageCount = queue.getMessageCount(); -// -// if (address.toString().startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX) && settings.isAutoDeleteJmsQueues() && queue.getMessageCount() == 0) { -// if (ActiveMQJMSServerLogger.LOGGER.isDebugEnabled()) { -// ActiveMQJMSServerLogger.LOGGER.debug("deleting auto-created queue \"" + queueName + ".\" consumerCount = " + consumerCount + "; messageCount = " + messageCount + "; isAutoDeleteJmsQueues = " + settings.isAutoDeleteJmsQueues()); -// } -// -// return destroyQueue(queueName.toString().substring(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX.length()), false); -// } else { -// return false; -// } -// } -// } - - /** - * When a core queue is created with a jms.topic prefix this class will create the associated JMS resources - * retroactively. This would happen if, for example, a client created a subscription a non-existent JMS topic and - * autoCreateJmsTopics = true. - */ -// class JMSPostQueueCreationCallback implements PostQueueCreationCallback { -// -// @Override -// public void callback(SimpleString queueName) throws Exception { -// Queue queue = server.locateQueue(queueName); -// String address = queue.getAddress().toString(); -// -// AddressSettings settings = server.getAddressSettingsRepository().getMatch(address.toString()); -// /* When a topic is created a dummy subscription is created which never receives any messages; when the queue -// * for that dummy subscription is created we don't want to call createTopic again. Therefore we make sure the -// * queue name doesn't start with the topic prefix. -// */ -// if (address.toString().startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX) && settings.isAutoCreateAddresses() && !queueName.toString().startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX)) { -// createTopic(false, address.toString().substring(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX.length()), true); -// } -// } -// } - - /** - * When a core queue representing a JMS topic subscription is deleted this class will check to see if that was the - * last subscription on the topic and if so and autoDeleteJmsTopics = true then it will delete the JMS resources - * for that topic. - */ -// class JMSPostQueueDeletionCallback implements PostQueueDeletionCallback { -// -// @Override -// public void callback(SimpleString address, SimpleString queueName) throws Exception { -// Queue queue = server.locateQueue(address); -// Collection bindings = server.getPostOffice().getBindingsForAddress(address).getBindings(); -// -// AddressSettings settings = server.getAddressSettingsRepository().getMatch(address.toString()); -// -// if (address.toString().startsWith(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX) && settings.isAutoDeleteJmsTopics() && bindings.size() == 1 && queue != null && queue.isAutoCreated()) { -// try { -// destroyTopic(address.toString().substring(ActiveMQDestination.JMS_TOPIC_ADDRESS_PREFIX.length())); -// } catch (IllegalStateException e) { -// /* -// * During shutdown the callback can be invoked after the JMSServerManager is already shut down so we just -// * ignore the exception in that case -// */ -// if (ActiveMQJMSServerLogger.LOGGER.isDebugEnabled()) { -// ActiveMQJMSServerLogger.LOGGER.debug("Failed to destroy topic", e); -// } -// } -// } -// } -// } - private final class JMSReloader implements ReloadCallback { @Override diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java index a75f2df3523..2302ce59c0f 100644 --- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java +++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/connection/TopicConnectionTest.java @@ -95,48 +95,4 @@ public void testSetClientID_2() { Assert.fail("Should raise a javax.jms.IllegalStateException, not a java.lang.IllegalStateException"); } } - - /** - * Test that if another connection with the same clientID is already running when - * Test that a call to {@code setClientID} will throw an - * {@code IllegalStateException} if a client ID has already been set - * This test is relevant only if the ID is set by the JMS client - * see JMS javadoc - * http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String) - * - *... This test is not valid... as getClientID is caleld before setClientID - */ - /*public void testSetClientID_3() - { - try - { - // we start from a clean state for the first connection - subscriberConnection.close(); - subscriberConnection = null; - - subscriberConnection = subscriberTCF.createTopicConnection(); - // if the JMS provider has set a client ID, this test is not relevant - if (subscriberConnection.getClientID() != null) - { - return; - } - // the JMS provider has not set a client ID, so we do - subscriberConnection.setClientID("testSetClientID_3"); - assertEquals("testSetClientID_3", subscriberConnection.getClientID()); - - // we create a new connection and try to set the same ID than for subscriberConnection - TopicConnection connection_2 = subscriberTCF.createTopicConnection(); - assertTrue(connection_2.getClientID() == null); - connection_2.setClientID("testSetClientID_3"); - fail("Should throw a javax.jms.InvalidClientIDException"); - } - catch (InvalidClientIDException e) - { - } - catch (JMSException e) - { - fail(e); - } - }*/ - }