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 | 96104c64d2e8c984ec53cc2864b142b377d07f61 (patch) | |
| tree | 1f1dd9a9a4ee05b976bd34452340b4a1301fdccd /qpid/java | |
| parent | 79c932390b6a86cafd2a1b3c18fc43a8e333ec7e (diff) | |
| download | qpid-python-96104c64d2e8c984ec53cc2864b142b377d07f61.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@718554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java b/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java index 20beec5cc4..2389c9e2da 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java +++ b/qpid/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() |
