gemmellr commented on code in PR #5477:
URL: https://github.com/apache/activemq-artemis/pull/5477#discussion_r1934275466


##########
artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java:
##########
@@ -549,27 +549,27 @@ public void 
sendAcknowledged(org.apache.activemq.artemis.api.core.Message client
 
       @Override
       public void sendFailed(org.apache.activemq.artemis.api.core.Message 
clientMessage, Exception exception) {
-         if (jmsMessage instanceof StreamMessage) {
+         if (jmsMessage instanceof StreamMessage message) {
             try {
-               ((StreamMessage) jmsMessage).reset();
+               message.reset();
             } catch (JMSException e) {
                // HORNETQ-1209 XXX ignore?
             }
          }
-         if (jmsMessage instanceof BytesMessage) {
+         if (jmsMessage instanceof BytesMessage message) {
             try {
-               ((BytesMessage) jmsMessage).reset();
+               message.reset();
             } catch (JMSException e) {
                // HORNETQ-1209 XXX ignore?
             }
          }
 
          try {
             producer.connection.getThreadAwareContext().setCurrentThread(true);
-            if (exception instanceof ActiveMQException) {
-               exception = 
JMSExceptionHelper.convertFromActiveMQException((ActiveMQException) exception);
-            } else if (exception instanceof ActiveMQInterruptedException) {
-               exception = 
JMSExceptionHelper.convertFromActiveMQException((ActiveMQInterruptedException) 
exception);
+            if (exception instanceof ActiveMQException qException) {
+               exception = 
JMSExceptionHelper.convertFromActiveMQException(qException);

Review Comment:
   ```suggestion
               if (exception instanceof ActiveMQException amqException) {
                  exception = 
JMSExceptionHelper.convertFromActiveMQException(amqException);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to