reformat layout

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/4440130a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/4440130a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/4440130a

Branch: refs/heads/master
Commit: 4440130a98f79ddac181b039ce3e370bad62d85e
Parents: 589fe0c
Author: Robert Gemmell <[email protected]>
Authored: Tue Feb 3 12:08:57 2015 +0000
Committer: Robert Gemmell <[email protected]>
Committed: Tue Feb 3 12:08:57 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/qpid/jms/example/Drain.java | 36 +++++++-------------
 1 file changed, 12 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/4440130a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Drain.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Drain.java 
b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Drain.java
index 82581ef..0c82c76 100644
--- a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Drain.java
+++ b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Drain.java
@@ -31,28 +31,22 @@ import javax.jms.TextMessage;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
-public class Drain
-{
+public class Drain {
     private static final String USER = "guest";
     private static final String PASSWORD = "guest";
     private static final int DEFAULT_COUNT = 10;
 
-    public static void main(String[] args) throws Exception
-    {
+    public static void main(String[] args) throws Exception {
         int count = DEFAULT_COUNT;
-        if( args.length == 0 )
-        {
+        if (args.length == 0) {
             System.out.println("Consuming up to " + count + " messages.");
             System.out.println("Specify a message count as the program 
argument if you wish to consume a different amount.");
-        }
-        else
-        {
+        } else {
             count = Integer.parseInt(args[0]);
             System.out.println("Consuming up to " + count + " messages.");
         }
 
-        try
-        {
+        try {
             // JNDI information can be configured by including an file named 
jndi.properties
             // on the classpath, containing the "java.naming.factory.initial" 
configuration
             // and properties configuring required ConnectionFactory and 
Destination objects.
@@ -78,33 +72,27 @@ public class Drain
             int actualCount = 0;
             boolean deductTimeout = false;
             int timeout = 1000;
-            for(int i = 1; i <= count; i++, actualCount++)
-            {
-                TextMessage message = 
(TextMessage)messageConsumer.receive(timeout);
-                if(message == null)
-                {
+            for (int i = 1; i <= count; i++, actualCount++) {
+                TextMessage message = (TextMessage) 
messageConsumer.receive(timeout);
+                if (message == null) {
                     System.out.println("Message " + i + " not received within 
timeout, stopping.");
                     deductTimeout = true;
                     break;
                 }
-                if(i % 100 == 0)
-                {
+                if (i % 100 == 0) {
                     System.out.println("Got message " + i + ":" + 
message.getText());
                 }
             }
 
             long finish = System.currentTimeMillis();
             long taken = finish - start;
-            if(deductTimeout)
-            {
+            if (deductTimeout) {
                 taken -= timeout;
             }
-            System.out.println("Received " + actualCount +" messages in " + 
taken + "ms");
+            System.out.println("Received " + actualCount + " messages in " + 
taken + "ms");
 
             connection.close();
-        }
-        catch (Exception exp)
-        {
+        } catch (Exception exp) {
             System.out.println("Caught exception, exiting.");
             exp.printStackTrace(System.out);
             System.exit(1);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to