http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java b/examples/features/ha/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java index 29ae381..cae5da1 100644 --- a/examples/features/ha/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java +++ b/examples/features/ha/replicated-failback/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedFailbackExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; @@ -28,6 +26,8 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import org.apache.activemq.artemis.util.ServerUtil; + /** * Example of live and replicating backup pair. * <p> @@ -101,8 +101,7 @@ public class ReplicatedFailbackExample { // backup server has occurred try { message0.acknowledge(); - } - catch (JMSException e) { + } catch (JMSException e) { System.out.println("Got (the expected) exception while acknowledging message: " + e.getMessage()); } @@ -119,8 +118,7 @@ public class ReplicatedFailbackExample { // backup server has occurred try { message0.acknowledge(); - } - catch (JMSException e) { + } catch (JMSException e) { System.err.println("Got exception while acknowledging message: " + e.getMessage()); } @@ -130,8 +128,7 @@ public class ReplicatedFailbackExample { System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); } message0.acknowledge(); - } - finally { + } finally { // Step 13. Be sure to close our resources! if (connection != null) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java b/examples/features/ha/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java index 491d792..c6b122b 100644 --- a/examples/features/ha/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java +++ b/examples/features/ha/replicated-multiple-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedMultipleFailoverExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; @@ -28,6 +26,8 @@ import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import org.apache.activemq.artemis.util.ServerUtil; + public class ReplicatedMultipleFailoverExample { private static Process server0; @@ -100,8 +100,7 @@ public class ReplicatedMultipleFailoverExample { // backup server has occurred try { message0.acknowledge(); - } - catch (JMSException e) { + } catch (JMSException e) { System.err.println("Got exception while acknowledging message: " + e.getMessage()); } @@ -118,8 +117,7 @@ public class ReplicatedMultipleFailoverExample { // backup server has occurred try { message0.acknowledge(); - } - catch (JMSException e) { + } catch (JMSException e) { System.err.println("Got exception while acknowledging message: " + e.getMessage()); } @@ -129,8 +127,7 @@ public class ReplicatedMultipleFailoverExample { System.out.printf("Got message: %s (redelivered?: %s)%n", message0.getText(), message0.getJMSRedelivered()); } message0.acknowledge(); - } - finally { + } finally { // Step 13. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java b/examples/features/ha/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java index e6887c7..cf387db 100644 --- a/examples/features/ha/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java +++ b/examples/features/ha/replicated-transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/ReplicatedTransactionFailoverExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -29,6 +26,9 @@ import javax.jms.TextMessage; import javax.jms.TransactionRolledBackException; import javax.naming.InitialContext; +import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.util.ServerUtil; + /** * A simple example that demonstrates failover of the JMS connection from one node to another * when the live server crashes using a JMS <em>transacted</em> session and replication. @@ -84,8 +84,7 @@ public class ReplicatedTransactionFailoverExample { // Step 9. As failover occurred during transaction, the session has been marked for rollback only try { session.commit(); - } - catch (TransactionRolledBackException e) { + } catch (TransactionRolledBackException e) { System.err.println("transaction has been rolled back: " + e.getMessage()); } @@ -111,8 +110,7 @@ public class ReplicatedTransactionFailoverExample { session.commit(); System.out.println("Other message on the server? " + consumer.receive(5000)); - } - finally { + } finally { // Step 13. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java b/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java index 4383b28..6d17dc9 100644 --- a/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java +++ b/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -28,6 +26,8 @@ import javax.jms.TextMessage; import javax.naming.InitialContext; import java.util.Hashtable; +import org.apache.activemq.artemis.util.ServerUtil; + /** * A simple example that demonstrates a colocated server */ @@ -106,8 +106,7 @@ public class ScaleDownExample { System.out.println("Got message: " + message0.getText()); } message0.acknowledge(); - } - finally { + } finally { // Step 11. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java b/examples/features/ha/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java index 38f06c0..90c9564 100644 --- a/examples/features/ha/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java +++ b/examples/features/ha/stop-server-failover/src/main/java/org/apache/activemq/artemis/jms/example/StopServerFailoverExample.java @@ -90,8 +90,7 @@ public class StopServerFailoverExample { // backup server has occurred try { message0.acknowledge(); - } - catch (JMSException e) { + } catch (JMSException e) { System.err.println("Got exception while acknowledging message: " + e.getMessage()); } @@ -101,8 +100,7 @@ public class StopServerFailoverExample { System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered()); } message0.acknowledge(); - } - finally { + } finally { // Step 13. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/ha/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java ---------------------------------------------------------------------- diff --git a/examples/features/ha/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java b/examples/features/ha/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java index 58c514a..8f69b94 100644 --- a/examples/features/ha/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java +++ b/examples/features/ha/transaction-failover/src/main/java/org/apache/activemq/artemis/jms/example/TransactionFailoverExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.api.core.Message; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -29,6 +26,9 @@ import javax.jms.TextMessage; import javax.jms.TransactionRolledBackException; import javax.naming.InitialContext; +import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.util.ServerUtil; + /** * A simple example that demonstrates failover of the JMS connection from one node to another * when the live server crashes using a JMS <em>transacted</em> session. @@ -84,8 +84,7 @@ public class TransactionFailoverExample { // Step 9. As failover occurred during transaction, the session has been marked for rollback only try { session.commit(); - } - catch (TransactionRolledBackException e) { + } catch (TransactionRolledBackException e) { System.err.println("transaction has been rolled back: " + e.getMessage()); } @@ -111,8 +110,7 @@ public class TransactionFailoverExample { session.commit(); System.out.println("Other message on the server? " + consumer.receive(5000)); - } - finally { + } finally { // Step 13. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java index ad92b08..ade1c5b 100644 --- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java +++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java @@ -62,8 +62,7 @@ public abstract class PerfBase { if (args != null && args.length > 0) { fileName = args[0]; - } - else { + } else { fileName = PerfBase.DEFAULT_PERF_PROPERTIES_FILE_NAME; } @@ -151,16 +150,14 @@ public abstract class PerfBase { destination = new org.apache.activemq.command.ActiveMQQueue(perfParams.getDestinationName()); connection = factory.createConnection(); - } - else if (perfParams.isCore()) { - factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri()); + } else if (perfParams.isCore()) { + factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri()); destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName()); connection = factory.createConnection(); - } - else if (perfParams.isAMQP()) { + } else if (perfParams.isAMQP()) { factory = new JmsConnectionFactory(perfParams.getUri()); destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName()); @@ -199,24 +196,20 @@ public abstract class PerfBase { sendMessages(perfParams.getNoOfMessagesToSend(), perfParams.getBatchSize(), perfParams.isDurable(), perfParams.isSessionTransacted(), true, perfParams.getThrottleRate(), perfParams.getMessageSize()); long end = System.currentTimeMillis(); displayAverage(perfParams.getNoOfMessagesToSend(), start, end); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (session != null) { try { session.close(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } if (connection != null) { try { connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } @@ -243,24 +236,20 @@ public abstract class PerfBase { long end = System.currentTimeMillis(); // start was set on the first received message displayAverage(perfParams.getNoOfMessagesToSend(), start, end); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { if (session != null) { try { session.close(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } if (connection != null) { try { connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } @@ -327,8 +316,7 @@ public abstract class PerfBase { if (i % txBatchSize == 0) { session.commit(); committed = true; - } - else { + } else { committed = false; } } @@ -402,8 +390,7 @@ public abstract class PerfBase { double duration = (1.0 * System.currentTimeMillis() - start) / 1000; PerfBase.log.info(String.format("received %6d messages in %2.2fs", currentCount, duration)); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfListener.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfListener.java b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfListener.java index 3f2c478..6d447c9 100644 --- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfListener.java +++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfListener.java @@ -29,8 +29,7 @@ public class PerfListener extends PerfBase { PerfParams params = PerfBase.getParams(fileName); new PerfListener(params).run(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java index 3e192c0..60e07e3 100644 --- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java +++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java @@ -181,7 +181,6 @@ public class PerfParams implements Serializable { this.libraryType = libraryType; } - public void setLibraryType(String libraryType) { this.libraryType = ClientLibraryType.valueOf(libraryType); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfSender.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfSender.java b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfSender.java index 6649bfa..b8cca50 100644 --- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfSender.java +++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfSender.java @@ -29,8 +29,7 @@ public class PerfSender extends PerfBase { PerfParams params = PerfBase.getParams(fileName); new PerfSender(params).run(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java index fe0905f..8002f1f 100644 --- a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java +++ b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakReceiver.java @@ -57,8 +57,7 @@ public class SoakReceiver { }); receiver.run(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -98,8 +97,7 @@ public class SoakReceiver { return; } - } - catch (JMSException e1) { + } catch (JMSException e1) { e1.printStackTrace(); } if (count.incrementAndGet() % modulo == 0) { @@ -135,8 +133,7 @@ public class SoakReceiver { connection.close(); connection = null; } - } - else { + } else { while (true) { Thread.sleep(500); } @@ -148,11 +145,9 @@ public class SoakReceiver { try { connection.setExceptionListener(null); connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); - } - finally { + } finally { connection = null; } } @@ -176,15 +171,12 @@ public class SoakReceiver { messageConsumer.setMessageListener(listener); connection.start(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { try { ic.close(); - } - catch (NamingException e) { + } catch (NamingException e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java ---------------------------------------------------------------------- diff --git a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java index d5868ea..839acba 100644 --- a/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java +++ b/examples/features/perf/soak/src/main/java/org/apache/activemq/artemis/jms/soak/example/SoakSender.java @@ -52,8 +52,7 @@ public class SoakSender { }); sender.run(); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -128,8 +127,7 @@ public class SoakSender { if (!runInfinitely && totalDuration > perfParams.getDurationInMinutes() * SoakBase.TO_MILLIS) { break; } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -148,11 +146,9 @@ public class SoakSender { try { connection.setExceptionListener(null); connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); - } - finally { + } finally { connection = null; } } @@ -180,15 +176,12 @@ public class SoakSender { producer.setDisableMessageTimestamp(perfParams.isDisableTimestamp()); connection.setExceptionListener(exceptionListener); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); - } - finally { + } finally { try { ic.close(); - } - catch (NamingException e) { + } catch (NamingException e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java b/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java index 4c0e3b9..8c5d327 100644 --- a/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java +++ b/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java @@ -147,12 +147,10 @@ public class BridgeExample { if (receivedMessage == null) { System.out.println("Didn't receive that message from mincing-machine on node 1"); - } - else { + } else { throw new IllegalStateException(); } - } - finally { + } finally { // Step 15. Be sure to close our resources! if (connection0 != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java b/examples/features/standard/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java index 1c9db3b..c307cbf 100644 --- a/examples/features/standard/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java +++ b/examples/features/standard/browser/src/main/java/org/apache/activemq/artemis/jms/example/QueueBrowserExample.java @@ -89,8 +89,7 @@ public class QueueBrowserExample { System.out.println("Received message: " + messageReceived.getText()); messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { // Step 15. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java b/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java index bf70e96..c8753ee 100644 --- a/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java +++ b/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java @@ -92,8 +92,7 @@ public class ClientKickoffExample { System.err.println("----------------------------------"); exception.get().printStackTrace(); System.err.println("----------------------------------"); - } - finally { + } finally { // Step 10. Be sure to close the resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java b/examples/features/standard/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java index fb98c76..bc2bbcc 100644 --- a/examples/features/standard/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java +++ b/examples/features/standard/consumer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ConsumerRateLimitExample.java @@ -100,8 +100,7 @@ public class ConsumerRateLimitExample { System.out.println("We consumed " + i + " messages in " + (end - start) + " milliseconds"); System.out.println("Actual consume rate was " + rate + " messages per second"); - } - finally { + } finally { // Step 9. Be sure to close our resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java b/examples/features/standard/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java index db28568..536d789 100644 --- a/examples/features/standard/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java +++ b/examples/features/standard/dead-letter/src/main/java/org/apache/activemq/artemis/jms/example/DeadLetterExample.java @@ -122,8 +122,7 @@ public class DeadLetterExample { // Step 23. This time, we commit the session, the delivery from the dead letter queue is successful! session.commit(); - } - finally { + } finally { // Step 24. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java b/examples/features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java index cc12293..e70fd6c 100644 --- a/examples/features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java +++ b/examples/features/standard/delayed-redelivery/src/main/java/org/apache/activemq/artemis/jms/example/DelayedRedeliveryExample.java @@ -112,8 +112,7 @@ public class DelayedRedeliveryExample { " after " + (end - start) + " milliseconds."); - } - finally { + } finally { // Step 17. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java b/examples/features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java index e014693..98740fe 100644 --- a/examples/features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java +++ b/examples/features/standard/divert/src/main/java/org/apache/activemq/artemis/jms/example/DivertExample.java @@ -199,8 +199,7 @@ public class DivertExample { System.out.println("Received forwarded price update on server 2: " + priceUpdate2.getText()); System.out.println("Time of forward: " + priceUpdate2.getLongProperty("time_of_forward")); - } - finally { + } finally { if (connectionLondon != null) { connectionLondon.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java b/examples/features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java index 46cd94c..179f230 100644 --- a/examples/features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java +++ b/examples/features/standard/durable-subscription/src/main/java/org/apache/activemq/artemis/jms/example/DurableSubscriptionExample.java @@ -101,8 +101,7 @@ public class DurableSubscriptionExample { // Step 18. Delete the durable subscription session.unsubscribe("subscriber-1"); - } - finally { + } finally { if (connection != null) { // Step 19. Be sure to close our JMS resources! connection.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index 31fc14a..7e7dd60 100644 --- a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -72,8 +72,7 @@ public class EmbeddedExample { connection.start(); TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000); System.out.println("Received message:" + messageReceived.getText()); - } - finally { + } finally { // Step 11. Stop the JMS server jmsServer.stop(); System.out.println("Stopped the JMS Server"); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index 6118ea9..61f5a01 100644 --- a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -23,8 +23,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; -import java.util.Date; import java.util.Arrays; +import java.util.Date; import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.config.Configuration; @@ -46,35 +46,21 @@ public final class EmbeddedExample { public static void main(final String[] args) throws Exception { // Step 1. Create ActiveMQ Artemis core configuration, and set the properties accordingly - Configuration configuration = new ConfigurationImpl() - .setPersistenceEnabled(false) - .setJournalDirectory("target/data/journal") - .setSecurityEnabled(false) - .addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName())) - .addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName())); + Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setJournalDirectory("target/data/journal").setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(NettyAcceptorFactory.class.getName())).addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName())); // Step 2. Create the JMS configuration JMSConfiguration jmsConfig = new JMSConfigurationImpl(); // Step 3. Configure the JMS ConnectionFactory - ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl() - .setName("cf") - .setConnectorNames(Arrays.asList("connector")) - .setBindings("cf"); + ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(Arrays.asList("connector")).setBindings("cf"); jmsConfig.getConnectionFactoryConfigurations().add(cfConfig); // Step 4. Configure the JMS Queue - JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl() - .setName("queue1") - .setDurable(false) - .setBindings("queue/queue1"); + JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1"); jmsConfig.getQueueConfigurations().add(queueConfig); // Step 5. Start the JMS Server using the ActiveMQ Artemis core server and the JMS configuration - EmbeddedJMS jmsServer = new EmbeddedJMS() - .setConfiguration(configuration) - .setJmsConfiguration(jmsConfig) - .start(); + EmbeddedJMS jmsServer = new EmbeddedJMS().setConfiguration(configuration).setJmsConfiguration(jmsConfig).start(); System.out.println("Started Embedded JMS Server"); // Step 6. Lookup JMS resources defined in the configuration @@ -94,8 +80,7 @@ public final class EmbeddedExample { connection.start(); TextMessage messageReceived = (TextMessage) messageConsumer.receive(1000); System.out.println("Received message:" + messageReceived.getText()); - } - finally { + } finally { if (connection != null) { connection.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java b/examples/features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java index 996da74..94ac96c 100644 --- a/examples/features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java +++ b/examples/features/standard/expiry/src/main/java/org/apache/activemq/artemis/jms/example/ExpiryExample.java @@ -106,8 +106,7 @@ public class ExpiryExample { System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_AMQ_ORIG_ADDRESS")); // Step 21. the actual expiration time is stored in the _AMQ_ACTUAL_EXPIRY property System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_AMQ_ACTUAL_EXPIRY")); - } - finally { + } finally { // Step 22. Be sure to close the resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java b/examples/features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java index 265f0c6..0dded7a 100644 --- a/examples/features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java +++ b/examples/features/standard/http-transport/src/main/java/org/apache/activemq/artemis/jms/example/HttpTransportExample.java @@ -71,8 +71,7 @@ public class HttpTransportExample { System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { if (connection != null) { connection.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java b/examples/features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java index 47bc66c..5895ecc 100644 --- a/examples/features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java +++ b/examples/features/standard/instantiate-connection-factory/src/main/java/org/apache/activemq/artemis/jms/example/InstantiateConnectionFactoryExample.java @@ -71,8 +71,7 @@ public class InstantiateConnectionFactoryExample { TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { if (connection != null) { connection.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java b/examples/features/standard/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java index b78875f..251f2a2 100644 --- a/examples/features/standard/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java +++ b/examples/features/standard/interceptor/src/main/java/org/apache/activemq/artemis/jms/example/InterceptorExample.java @@ -74,8 +74,7 @@ public class InterceptorExample { System.out.println("Received message [" + messageReceived.getText() + "] with String property: " + messageReceived.getStringProperty("newproperty")); - } - finally { + } finally { // Step 12. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java index 23946b0..82e8819 100644 --- a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java +++ b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java @@ -99,8 +99,7 @@ public class JMSBridgeExample { // Step 11. Display the received message's ID and this "bridged" message ID System.out.format("Message ID : %s%n", messageReceived.getJMSMessageID()); System.out.format("Bridged Message ID : %s%n", messageReceived.getStringProperty("AMQ_BRIDGE_MSG_ID_LIST")); - } - finally { + } finally { // Step 12. Be sure to close the resources! jmsBridge.stop(); if (sourceContext != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java b/examples/features/standard/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java index 4688ba3..ffe0b0d 100644 --- a/examples/features/standard/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java +++ b/examples/features/standard/jms-completion-listener/src/main/java/org/apache/activemq/artemis/jms/example/JMSCompletionListenerExample.java @@ -22,7 +22,6 @@ import javax.jms.JMSContext; import javax.jms.JMSProducer; import javax.jms.Message; import javax.jms.Queue; - import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -72,8 +71,7 @@ public class JMSCompletionListenerExample { if (!latch.await(5, TimeUnit.SECONDS)) { throw new IllegalStateException("Completion listener not called as expected."); } - } - finally { + } finally { if (jmsContext != null) { jmsContext.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java b/examples/features/standard/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java index da43eb0..d226dbf 100644 --- a/examples/features/standard/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java +++ b/examples/features/standard/jms-shared-consumer/src/main/java/org/apache/activemq/artemis/jms/example/JMSSharedConsumerExample.java @@ -70,8 +70,7 @@ public class JMSSharedConsumerExample { body = jmsConsumer2.receiveBody(String.class, 5000); System.out.println("body = " + body); - } - finally { + } finally { // Step 11. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java index 108897f..44be2f9 100644 --- a/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java +++ b/examples/features/standard/jmx/src/main/java/org/apache/activemq/artemis/jms/example/JMXExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.HashMap; - import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; @@ -33,6 +31,7 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.InitialContext; +import java.util.HashMap; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.jms.management.JMSQueueControl; @@ -107,8 +106,7 @@ public class JMXExample { // The call will timeout after 5000ms and messageReceived will be null TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived); - } - finally { + } finally { // Step 20. Be sure to close the resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java b/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java index b400d41..702fe41 100644 --- a/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java +++ b/examples/features/standard/large-message/src/main/java/org/apache/activemq/artemis/jms/example/LargeMessageExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import org.apache.activemq.artemis.util.ServerUtil; - import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -33,6 +31,8 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import org.apache.activemq.artemis.util.ServerUtil; + /** * This example demonstrates the ability of ActiveMQ Artemis to send and consume a very large message, much * bigger than can fit in RAM. @@ -166,8 +166,7 @@ public class LargeMessageExample { } System.out.println("File streamed to disk. Size of received file on disk is " + outputFile.length()); - } - finally { + } finally { // Step 12. Be sure to close our resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java b/examples/features/standard/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java index 317835b..d164e13 100644 --- a/examples/features/standard/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java +++ b/examples/features/standard/last-value-queue/src/main/java/org/apache/activemq/artemis/jms/example/LastValueQueueExample.java @@ -93,8 +93,7 @@ public class LastValueQueueExample { System.out.format("Received message: %s%n", messageReceived); cf.close(); - } - finally { + } finally { // Step 13. Be sure to close our JMS resources! if (connection != null) { connection.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java b/examples/features/standard/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java index fed21b0..94f6418 100644 --- a/examples/features/standard/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java +++ b/examples/features/standard/management-notifications/src/main/java/org/apache/activemq/artemis/jms/example/ManagementNotificationExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.Enumeration; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; @@ -29,6 +27,7 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; import javax.naming.InitialContext; +import java.util.Enumeration; /** * An example that shows how to receive management notifications using JMS messages. @@ -70,8 +69,7 @@ public class ManagementNotificationExample { String propertyName = (String) propertyNames.nextElement(); System.out.format(" %s: %s%n", propertyName, notif.getObjectProperty(propertyName)); } - } - catch (JMSException e) { + } catch (JMSException e) { } System.out.println("------------------------"); } @@ -89,15 +87,13 @@ public class ManagementNotificationExample { // Step 10. Try to create a connection with unknown user try { cf.createConnection("not.a.valid.user", "not.a.valid.password"); - } - catch (JMSException e) { + } catch (JMSException e) { } // sleep a little bit to be sure to receive the notification for the security // authentication violation before leaving the example Thread.sleep(2000); - } - finally { + } finally { // Step 11. Be sure to close the resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java b/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java index 73375d6..79a4898 100644 --- a/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java +++ b/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java @@ -119,8 +119,7 @@ public class ManagementExample { // there is none to consume. The call will timeout after 5000ms and messageReceived will be null TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived); - } - finally { + } finally { // Step 23. Be sure to close the resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java index 8e6cc26..5fc8245 100644 --- a/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java +++ b/examples/features/standard/message-counters/src/main/java/org/apache/activemq/artemis/jms/example/MessageCounterExample.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.HashMap; - import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; @@ -33,6 +31,7 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.naming.InitialContext; +import java.util.HashMap; import org.apache.activemq.artemis.api.core.management.MessageCounterInfo; import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; @@ -112,8 +111,7 @@ public class MessageCounterExample { counters = queueControl.listMessageCounter(); messageCounter = MessageCounterInfo.fromJSON(counters); displayMessageCounter(messageCounter); - } - finally { + } finally { // Step 17. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java b/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java index f8ee48a..e04b790 100644 --- a/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java +++ b/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java @@ -89,8 +89,7 @@ public class MessageGroupExample { } cf.close(); - } - finally { + } finally { // Step 11. Be sure to close our JMS resources! if (connection != null) { connection.close(); @@ -115,9 +114,8 @@ class SimpleMessageListener implements MessageListener { TextMessage msg = (TextMessage) message; System.out.format("Message: [%s] received by %s%n", msg.getText(), name); messageReceiverMap.put(msg.getText(), name); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java b/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java index 4b24928..740d83b 100644 --- a/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java +++ b/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java @@ -96,8 +96,7 @@ public class MessageGroup2Example { throw new IllegalStateException("Group message [producer2 message " + i + "] went to wrong receiver: " + receiver); } } - } - finally { + } finally { //Step 11. Be sure to close our JMS resources! if (connection != null) { connection.close(); @@ -122,9 +121,8 @@ class SimpleMessageListener implements MessageListener { TextMessage msg = (TextMessage) message; System.out.format("Message: [%s] received by %s%n", msg.getText(), name); messageReceiverMap.put(msg.getText(), name); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java b/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java index 113f9fe..2208445 100644 --- a/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java +++ b/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicBoolean; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; @@ -30,6 +27,8 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; @@ -79,11 +78,9 @@ public class MessagePriorityExample { "with priority: " + sentMessages[2].getJMSPriority()); - MessageConsumer redConsumer = session.createConsumer(queue); redConsumer.setMessageListener(new SimpleMessageListener(msgReceived, result)); - // Step 10. Start the connection now. connection.start(); @@ -100,8 +97,7 @@ public class MessagePriorityExample { if (!result.get()) throw new IllegalStateException(); - } - finally { + } finally { // Step 13. Be sure to close our JMS resources! if (connection != null) { connection.close(); @@ -125,8 +121,7 @@ class SimpleMessageListener implements MessageListener { TextMessage textMessage = (TextMessage) msg; try { System.out.println("Received message : [" + textMessage.getText() + "]"); - } - catch (JMSException e) { + } catch (JMSException e) { result.set(false); } msgReceived.add(textMessage); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java b/examples/features/standard/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java index 6f321b0..6bb1904 100644 --- a/examples/features/standard/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java +++ b/examples/features/standard/no-consumer-buffering/src/main/java/org/apache/activemq/artemis/jms/example/NoConsumerBufferingExample.java @@ -98,8 +98,7 @@ public class NoConsumerBufferingExample { System.out.println("Consumed message from consumer1: " + message.getText()); } - } - finally { + } finally { // Step 9. Be sure to close our resources! if (connection != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java b/examples/features/standard/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java index 19d8a17..165fae2 100644 --- a/examples/features/standard/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java +++ b/examples/features/standard/paging/src/main/java/org/apache/activemq/artemis/jms/example/PagingExample.java @@ -118,8 +118,7 @@ public class PagingExample { message.acknowledge(); } - } - finally { + } finally { // And finally, always remember to close your JMS connections after use, in a finally block. Closing a JMS // connection will automatically close all of its sessions, consumers, producer and browser objects http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java b/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java index 5c809f8..4962535 100644 --- a/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java +++ b/examples/features/standard/pre-acknowledge/src/main/java/org/apache/activemq/artemis/jms/example/PreacknowledgeExample.java @@ -92,8 +92,7 @@ public class PreacknowledgeExample { TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { // Step 9. Be sure to close our resources! if (connection != null) { connection.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java b/examples/features/standard/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java index a7623bb..e3afaa3 100644 --- a/examples/features/standard/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java +++ b/examples/features/standard/producer-rate-limit/src/main/java/org/apache/activemq/artemis/jms/example/ProducerRateLimitExample.java @@ -95,8 +95,7 @@ public class ProducerRateLimitExample { } System.out.println("Received " + i + " messages"); - } - finally { + } finally { // Step 9. Be sure to close our resources! if (connection != null) { connection.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java b/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java index 607d82f..3fec19a 100644 --- a/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java +++ b/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/QueueRequestorExample.java @@ -75,14 +75,12 @@ public class QueueRequestorExample { // Step 13. close the text reverser service reverserService.close(); - } - finally { + } finally { if (connection != null) { try { // Step 14. Be sure to close the JMS resources! connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/TextReverserService.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/TextReverserService.java b/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/TextReverserService.java index 12c5272ac..8e72f0f 100644 --- a/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/TextReverserService.java +++ b/examples/features/standard/queue-requestor/src/main/java/org/apache/activemq/artemis/jms/example/TextReverserService.java @@ -82,8 +82,7 @@ public class TextReverserService implements MessageListener { // send the reply producer.send(reply); } - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } @@ -95,8 +94,7 @@ public class TextReverserService implements MessageListener { try { // be sure to close the JMS resources connection.close(); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java b/examples/features/standard/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java index b915dd0..68d8e70 100644 --- a/examples/features/standard/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java +++ b/examples/features/standard/queue-selector/src/main/java/org/apache/activemq/artemis/jms/example/QueueSelectorExample.java @@ -99,8 +99,7 @@ public class QueueSelectorExample { if (!result.get()) throw new IllegalStateException(); - } - finally { + } finally { // Step 12. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); @@ -135,8 +134,7 @@ class SimpleMessageListener implements MessageListener { if (!colorProp.equals(name) && !name.equals("any")) { result.set(false); } - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); result.set(false); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java b/examples/features/standard/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java index b6ce381..6a80dc2 100644 --- a/examples/features/standard/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java +++ b/examples/features/standard/queue/src/main/java/org/apache/activemq/artemis/jms/example/QueueExample.java @@ -70,8 +70,7 @@ public class QueueExample { TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { // Step 12. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java b/examples/features/standard/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java index 459c33b..b76afb4 100644 --- a/examples/features/standard/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java +++ b/examples/features/standard/reattach-node/src/main/java/org/apache/activemq/artemis/jms/example/ReattachExample.java @@ -93,8 +93,7 @@ public class ReattachExample { TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000); System.out.println("Received message: " + messageReceived.getText()); - } - finally { + } finally { // Step 14. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close(); @@ -139,8 +138,7 @@ public class ReattachExample { JMSManagementHelper.putOperationInvocation(m, "core.acceptor.netty-acceptor", oper); producer.send(m); - } - finally { + } finally { if (connection != null) { connection.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java b/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java index edab71c..6ba2618 100644 --- a/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java +++ b/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.util.HashMap; -import java.util.Map; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -32,6 +29,8 @@ import javax.jms.Session; import javax.jms.TemporaryQueue; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.util.HashMap; +import java.util.Map; /** * A simple JMS example that shows how to use Request/Replay style messaging. @@ -118,8 +117,7 @@ public class RequestReplyExample { // Step 19. Shutdown the request server server.shutdown(); - } - finally { + } finally { // Step 20. Be sure to close our JMS resources! if (connection != null) { connection.close(); @@ -191,8 +189,7 @@ class SimpleRequestServer implements MessageListener { replyProducer.send(replyDestination, replyMessage); System.out.println("Reply sent"); - } - catch (JMSException e) { + } catch (JMSException e) { e.printStackTrace(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/dup-send/src/main/java/ReceiveOrder.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/dup-send/src/main/java/ReceiveOrder.java b/examples/features/standard/rest/dup-send/src/main/java/ReceiveOrder.java index d6dcb81..e16d4ee 100644 --- a/examples/features/standard/rest/dup-send/src/main/java/ReceiveOrder.java +++ b/examples/features/standard/rest/dup-send/src/main/java/ReceiveOrder.java @@ -36,16 +36,14 @@ public class ReceiveOrder { if (res.getStatus() == 503) { System.out.println("Timeout..."); consumeNext = res.getHeaderAsLink("msg-consume-next"); - } - else if (res.getStatus() == 200) { + } else if (res.getStatus() == 200) { Order order = (Order) res.getEntity(Order.class); System.out.println(order); consumeNext = res.getHeaderAsLink("msg-consume-next"); - } - else { + } else { throw new RuntimeException("Failure! " + res.getStatus()); } res.releaseConnection(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java b/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java index 0a0d5ae..10fb311 100644 --- a/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java +++ b/examples/features/standard/rest/javascript-chat/src/test/java/org/jboss/resteasy/messaging/test/AutoAckTopicTest.java @@ -16,10 +16,10 @@ */ package org.jboss.resteasy.messaging.test; +import org.apache.activemq.artemis.rest.util.LinkStrategy; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.spi.Link; -import org.apache.activemq.artemis.rest.util.LinkStrategy; import org.junit.Assert; public class AutoAckTopicTest { @@ -85,4 +85,4 @@ public class AutoAckTopicTest { */ } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java index 455540c..54ca51f 100644 --- a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java +++ b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsReceive.java @@ -15,10 +15,6 @@ * limitations under the License. */ -import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; -import org.apache.activemq.artemis.rest.Jms; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -27,6 +23,10 @@ import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; +import org.apache.activemq.artemis.rest.Jms; + public class JmsReceive { public static void main(String[] args) throws Exception { @@ -38,15 +38,15 @@ public class JmsReceive { Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer(destination); consumer.setMessageListener(new MessageListener() { - @Override - public void onMessage(Message message) { - System.out.println("Received Message: "); - Order order = Jms.getEntity(message, Order.class); - System.out.println(order); - } - }); + @Override + public void onMessage(Message message) { + System.out.println("Received Message: "); + Order order = Jms.getEntity(message, Order.class); + System.out.println(order); + } + }); conn.start(); Thread.sleep(1000000); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java index 0cde207..7d5734f 100644 --- a/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java +++ b/examples/features/standard/rest/jms-to-rest/src/main/java/JmsSend.java @@ -15,9 +15,6 @@ * limitations under the License. */ -import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -25,6 +22,9 @@ import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Session; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; + public class JmsSend { public static void main(String[] args) throws Exception { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java b/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java index a4754d0..34b9154 100644 --- a/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java +++ b/examples/features/standard/rest/jms-to-rest/src/main/java/RestReceive.java @@ -35,15 +35,13 @@ public class RestReceive { if (res.getStatus() == 503) { System.out.println("Timeout..."); ackNext = res.getHeaderAsLink("msg-acknowledge-next"); - } - else if (res.getStatus() == 200) { + } else if (res.getStatus() == 200) { Order order = (Order) res.getEntity(Order.class); System.out.println(order); Link ack = res.getHeaderAsLink("msg-acknowledgement"); res = ack.request().formParameter("acknowledge", "true").post(); ackNext = res.getHeaderAsLink("msg-acknowledge-next"); - } - else { + } else { throw new RuntimeException("Failure! " + res.getStatus()); } res.releaseConnection(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/push/src/main/java/PostOrder.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/push/src/main/java/PostOrder.java b/examples/features/standard/rest/push/src/main/java/PostOrder.java index b37adf7..5ceaecd 100644 --- a/examples/features/standard/rest/push/src/main/java/PostOrder.java +++ b/examples/features/standard/rest/push/src/main/java/PostOrder.java @@ -15,9 +15,6 @@ * limitations under the License. */ -import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -25,6 +22,9 @@ import javax.jms.MessageProducer; import javax.jms.ObjectMessage; import javax.jms.Session; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; + public class PostOrder { public static void main(String[] args) throws Exception { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/rest/push/src/main/java/ReceiveShipping.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/rest/push/src/main/java/ReceiveShipping.java b/examples/features/standard/rest/push/src/main/java/ReceiveShipping.java index b82bbe8..b422c03 100644 --- a/examples/features/standard/rest/push/src/main/java/ReceiveShipping.java +++ b/examples/features/standard/rest/push/src/main/java/ReceiveShipping.java @@ -15,10 +15,6 @@ * limitations under the License. */ -import org.apache.activemq.artemis.jms.client.ActiveMQDestination; -import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; -import org.apache.activemq.artemis.rest.Jms; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; @@ -27,6 +23,10 @@ import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; +import org.apache.activemq.artemis.jms.client.ActiveMQDestination; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; +import org.apache.activemq.artemis.rest.Jms; + public class ReceiveShipping { public static void main(String[] args) throws Exception { @@ -37,15 +37,15 @@ public class ReceiveShipping { Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer(destination); consumer.setMessageListener(new MessageListener() { - @Override - public void onMessage(Message message) { - System.out.println("Received Message: "); - Order order = Jms.getEntity(message, Order.class); - System.out.println(order); - } - }); + @Override + public void onMessage(Message message) { + System.out.println("Received Message: "); + Order order = Jms.getEntity(message, Order.class); + System.out.println(order); + } + }); conn.start(); Thread.sleep(1000000); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/examples/features/standard/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java ---------------------------------------------------------------------- diff --git a/examples/features/standard/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java b/examples/features/standard/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java index ba86949..98e4776 100644 --- a/examples/features/standard/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java +++ b/examples/features/standard/scheduled-message/src/main/java/org/apache/activemq/artemis/jms/example/ScheduledMessageExample.java @@ -16,9 +16,6 @@ */ package org.apache.activemq.artemis.jms.example; -import java.text.SimpleDateFormat; -import java.util.Date; - import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.MessageConsumer; @@ -27,6 +24,8 @@ import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; +import java.text.SimpleDateFormat; +import java.util.Date; import org.apache.activemq.artemis.api.core.Message; @@ -80,8 +79,7 @@ public class ScheduledMessageExample { System.out.println("Received message: " + messageReceived.getText()); System.out.println("Time of receive: " + formatter.format(new Date())); - } - finally { + } finally { // Step 13. Be sure to close our JMS resources! if (initialContext != null) { initialContext.close();
