diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2008-11-18 11:02:07 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2008-11-18 11:02:07 +0000 |
| commit | ef3a12f42c3c882a81f9aaeed7f87b0bdad89725 (patch) | |
| tree | c8ad1da2c0f82a733d5023028f2fa2fcc8a26b62 /java/client/src | |
| parent | 619013648b34f1b65eece44afe44d3f97dc15b09 (diff) | |
| download | qpid-python-ef3a12f42c3c882a81f9aaeed7f87b0bdad89725.tar.gz | |
QPID-1454 : Synchronize round the setting and usage of _failoverLatch, with a new lock.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@718554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index 20beec5cc4..2389c9e2da 100644 --- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java @@ -164,6 +164,9 @@ public class AMQProtocolHandler extends IoHandlerAdapter /** Defines the default timeout to use for synchronous protocol commands. */ private final long DEFAULT_SYNC_TIMEOUT = Long.getLong("amqj.default_syncwrite_timeout", 1000 * 30); + /** Object to lock on when changing the latch */ + private Object _failoverLatchChange = new Object(); + /** * Creates a new protocol handler, associated with the specified client connection instance. * @@ -774,9 +777,12 @@ public class AMQProtocolHandler extends IoHandlerAdapter public void blockUntilNotFailingOver() throws InterruptedException { - if (_failoverLatch != null) + synchronized(_failoverLatchChange) { - _failoverLatch.await(); + if (_failoverLatch != null) + { + _failoverLatch.await(); + } } } @@ -792,7 +798,10 @@ public class AMQProtocolHandler extends IoHandlerAdapter public void setFailoverLatch(CountDownLatch failoverLatch) { - _failoverLatch = failoverLatch; + synchronized (_failoverLatchChange) + { + _failoverLatch = failoverLatch; + } } public AMQConnection getConnection() |
