diff options
author | Martin Ritchie <ritchiem@apache.org> | 2008-11-24 12:47:04 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2008-11-24 12:47:04 +0000 |
commit | 4240bf2abbcd48127b889a5197d05d193ab0b2c8 (patch) | |
tree | b06350d6337cd3461ad2de6b9e1cafd7346b5237 /java/client/example/src | |
parent | 4e3809074bb2eedf6b170d9a491a25335cf33eb7 (diff) | |
download | qpid-python-4240bf2abbcd48127b889a5197d05d193ab0b2c8.tar.gz |
QPID-1480 : Updated Simple Request Response code to loop on the shutdownHook to ensure that it is zero before exit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@720183 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/example/src')
-rw-r--r-- | java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java | 17 |
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 |