NO-JIRA fixing checkstyle on example
This commit is contained in:
parent
6822bad0cc
commit
24876d3fd1
|
@ -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);
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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. ");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue