You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/11/24 13:47:04 UTC

svn commit: r720183 - /incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java

Author: ritchiem
Date: Mon Nov 24 04:47:04 2008
New Revision: 720183

URL: http://svn.apache.org/viewvc?rev=720183&view=rev
Log:
QPID-1480 : Updated Simple Request Response code to loop on the shutdownHook to ensure that it is zero before exit.

Modified:
    incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java?rev=720183&r1=720182&r2=720183&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java Mon Nov 24 04:47:04 2008
@@ -65,7 +65,7 @@
     {
         setupJNDI();
 
-        Connection connection = null;
+        Connection connection;
         try
         {
             connection = ((ConnectionFactory) lookupJNDI(CONNECTION_JNDI_NAME)).createConnection();
@@ -97,13 +97,16 @@
         System.out.println("Server process started and waiting for messages.");
 
         //Wait to process an single message then quit.
-        try
-        {
-            _shutdownHook.await();
-        }
-        catch (InterruptedException e)
+        while (_shutdownHook.getCount() != 0)
         {
-            // Ignore this as we are quitting anyway.
+            try
+            {
+                _shutdownHook.await();
+            }
+            catch (InterruptedException e)
+            {
+                // Ignore this as we are quitting anyway.
+            }
         }
 
         //Close the connection