From 24876d3fd199b16bac0c866b40a4719401e818d3 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 20 Dec 2017 20:48:08 -0500 Subject: [PATCH] NO-JIRA fixing checkstyle on example --- .../artemis/jms/example/KillSlowConsumerExample.java | 9 +++------ .../artemis/jms/example/NotifySlowConsumerExample.java | 8 ++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/KillSlowConsumerExample.java b/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/KillSlowConsumerExample.java index fde6fe8eaa..3b0f6834d3 100644 --- a/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/KillSlowConsumerExample.java +++ b/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/KillSlowConsumerExample.java @@ -36,7 +36,6 @@ import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException; * - starts a consumer BUT does not consume any messages. * - waits for 8 seconds and tries to consume a message. * - receive an exception as the connection should already be closed. - * */ public class KillSlowConsumerExample { @@ -88,16 +87,14 @@ public class KillSlowConsumerExample { messageConsumer.receive(TimeUnit.SECONDS.toMillis(1)); //messageConsumer.receive() should throw exception - we should not get to here. - throw new RuntimeException("SlowConsumerExample.slowConsumerKill() FAILED - expected " + - "connection to be shutdown by Slow Consumer policy"); + throw new RuntimeException("SlowConsumerExample.slowConsumerKill() FAILED - expected " + "connection to be shutdown by Slow Consumer policy"); } catch (JMSException ex) { if (ex.getCause() instanceof ActiveMQObjectClosedException) { //received exception - as expected - System.out.println("SUCCESS! Received EXPECTED exception: " + ex ); + System.out.println("SUCCESS! Received EXPECTED exception: " + ex); } else { - throw new RuntimeException("SlowConsumerExample.slowConsumerKill() FAILED - expected " + - "ActiveMQObjectClosedException BUT got " + ex.getCause()); + throw new RuntimeException("SlowConsumerExample.slowConsumerKill() FAILED - expected " + "ActiveMQObjectClosedException BUT got " + ex.getCause()); } } } diff --git a/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/NotifySlowConsumerExample.java b/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/NotifySlowConsumerExample.java index b476bf8f28..cc713a7f99 100644 --- a/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/NotifySlowConsumerExample.java +++ b/examples/features/standard/slow-consumer/src/main/java/org/apache/activemq/artemis/jms/example/NotifySlowConsumerExample.java @@ -18,7 +18,6 @@ package org.apache.activemq.artemis.jms.example; import javax.jms.Connection; import javax.jms.ConnectionFactory; -import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; @@ -73,9 +72,7 @@ public class NotifySlowConsumerExample { // Step 8. create a consumer on the broker's management-notification-address Session notifSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - MessageConsumer notificationConsumer = notifSession.createConsumer(notificationTopic, - ManagementHelper.HDR_NOTIFICATION_TYPE + " = '" + - CoreNotificationType.CONSUMER_SLOW + "'"); + MessageConsumer notificationConsumer = notifSession.createConsumer(notificationTopic, ManagementHelper.HDR_NOTIFICATION_TYPE + " = '" + CoreNotificationType.CONSUMER_SLOW + "'"); // Step 9. add a message listener to consumer listening to broker's management-notification-address, // when it receives notification it signals main thread. @@ -104,8 +101,7 @@ public class NotifySlowConsumerExample { // Step 14. ensure CONSUMER_SLOW notification was received and "waitForSlowConsumerNotif" did not timeout if (!isNotified) { - throw new RuntimeException("SlowConsumerExample.demoSlowConsumerNotify() FAILED; timeout occurred before" + - " - slow consumer notification was received. "); + throw new RuntimeException("SlowConsumerExample.demoSlowConsumerNotify() FAILED; timeout occurred before" + " - slow consumer notification was received. "); } }