Do not retain reference to DOMRpcRouter in registrations 98/74098/4
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Jul 2018 22:58:50 +0000 (00:58 +0200)
committerJie Han <han.jie@zte.com.cn>
Wed, 18 Jul 2018 00:33:41 +0000 (00:33 +0000)
Once we have called removeListener() we will not interact with
the DOMRpcRouter, hence there is no need to retain a reference
to it.

Change-Id: I788646e91370ed15e246a95ac5585fbc4c897ac9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/DOMRpcRouter.java

index a3a0cfac5c25ae3dc56a58acc2c0b5f4912fd375..fe3acf8a8fd8a140f58de7170d1a8f9bea4e9c6c 100644 (file)
@@ -164,9 +164,8 @@ public final class DOMRpcRouter implements AutoCloseable, DOMRpcService, DOMRpcP
     private static final class Registration<T extends DOMRpcAvailabilityListener>
         extends AbstractListenerRegistration<T> {
 
-        private final DOMRpcRouter router;
-
         private Map<SchemaPath, Set<YangInstanceIdentifier>> prevRpcs;
+        private DOMRpcRouter router;
 
         Registration(final DOMRpcRouter router, final T listener,
                 final Map<SchemaPath, Set<YangInstanceIdentifier>> rpcs) {
@@ -178,6 +177,7 @@ public final class DOMRpcRouter implements AutoCloseable, DOMRpcService, DOMRpcP
         @Override
         protected void removeRegistration() {
             router.removeListener(this);
+            router = null;
         }
 
         void initialTable() {