BUG-5280: fix InversibleLock race 98/49698/1
authorRobert Varga <rovarga@cisco.com>
Wed, 21 Dec 2016 13:17:35 +0000 (14:17 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 21 Dec 2016 13:17:35 +0000 (14:17 +0100)
Do not read latch twice, as it may end up being
cleared asynchronously. This is a typo, as the reuse
is exactly why we read the latch into a local variable.

Change-Id: If90bd157be6e20d69f158bc749f163c1008541a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/InversibleLock.java

index ea4e5817dd807fc0680db7207030f12cd3be3229..08bc05346b65d1ce53faa7d3e64e8f38fc6a5359 100644 (file)
@@ -45,7 +45,7 @@ public final class InversibleLock {
             // and force release of locks.
             final CountDownLatch local = latch;
             if (local != null) {
             // and force release of locks.
             final CountDownLatch local = latch;
             if (local != null) {
-                throw new InversibleLockException(latch);
+                throw new InversibleLockException(local);
             }
 
             // No latch present: retry optimistic lock
             }
 
             // No latch present: retry optimistic lock