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 | bb6cd9d51e60923887d732146b131617ad3df6cd (patch) | |
| tree | 823402fc978df6ec432fe7bdbc5e975cd950ad7b /qpid/java/client/example | |
| parent | e102b63d04272bad22feba9a5bda9145c3273070 (diff) | |
| download | qpid-python-bb6cd9d51e60923887d732146b131617ad3df6cd.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@720183 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/example')
| -rw-r--r-- | qpid/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/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java index 63c7e95705..9c284eee97 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/simple/reqresp/Server.java +++ b/qpid/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 |
