summaryrefslogtreecommitdiff
path: root/java/client/example/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/client/example/src')
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java b/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java
index 63c7e95705..9c284eee97 100644
--- a/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java
+++ b/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java
@@ -65,7 +65,7 @@ public class Server implements MessageListener
{
setupJNDI();
- Connection connection = null;
+ Connection connection;
try
{
connection = ((ConnectionFactory) lookupJNDI(CONNECTION_JNDI_NAME)).createConnection();
@@ -97,13 +97,16 @@ public class Server implements MessageListener
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