This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 8eb52efadd241919eb25ff8359b04ff76babfbd5
Author: Justin Bertram <[email protected]>
AuthorDate: Tue Feb 18 13:49:31 2025 -0600

    NO-JIRA remove dead code with invalid JavaDoc
---
 .../jms/server/impl/JMSServerManagerImpl.java      | 94 ----------------------
 .../conform/connection/TopicConnectionTest.java    | 56 ++-----------
 2 files changed, 5 insertions(+), 145 deletions(-)

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 4fdf7f6b1f..4b8892e013 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
@@ -1522,100 +1522,6 @@ public class JMSServerManagerImpl extends 
CleaningActivateCallback implements JM
       }
    }
 
-   /**
-    * 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<Binding> 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 7a94ab11f2..2302ce59c0 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
@@ -25,16 +25,14 @@ import org.objectweb.jtests.jms.framework.PubSubTestCase;
 
 /**
  * Test topic-specific connection features.
- *
+ * <p>
  * Test setting of client ID which is relevant only for Durable Subscription
  */
-
 public class TopicConnectionTest extends PubSubTestCase {
 
    /**
-    * Test that a call to <code>setClientID</code> will throw an
-    * <code>IllegalStateException</code> if a client ID has already been set
-    * see JMS javadoc
+    * Test that a call to {@code setClientID} will throw an {@code 
IllegalStateException} if a client ID has already
+    * been set see JMS javadoc
     * 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String)
     */
    @Test
@@ -65,8 +63,8 @@ public class TopicConnectionTest extends PubSubTestCase {
    }
 
    /**
-    * Test that a call to <code>setClientID</code> can occur only after 
connection creation
-    * and before any other action on the connection.
+    * Test that a call to {@code setClientID} can occur only after connection 
creation and before any other action on
+    * the connection.
     * <em>This test is relevant only if the ID is set by the JMS client</em>
     * see JMS javadoc
     * 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Connection.html#setClientID(java.lang.String)
@@ -97,48 +95,4 @@ public class TopicConnectionTest extends PubSubTestCase {
          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
-    * <code>setClientID</code> is called, the JMS provider should detect the 
duplicate
-    * ID and throw an <code>InvalidClientIDException</code>
-    * <em>This test is relevant only if the ID is set by the JMS client</em>
-    * 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);
-      }
-   }*/
-
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to