Do not leak Promises 32/99132/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 15 Sep 2021 21:43:15 +0000 (23:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Dec 2021 09:20:27 +0000 (10:20 +0100)
We want to propagate only a read-only view of the connection process,
return a Future, not a Promise.

Change-Id: Iccfa83a20c3dd2a33ac4871ad58670256a068c66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 12a453bb73bae5b6583790ebc4f5a7bdc3fb5812)

netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/CallHomeChannelActivator.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallHomeMountSessionContext.java

index e217cd3a14ba6d7f5f06cacb89ce6ceddd63af5b..2ed801b55f4e7ea512d858d5e3c2fb58257b37c4 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.netconf.callhome.protocol;
 
-import io.netty.util.concurrent.Promise;
+import io.netty.util.concurrent.Future;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.netconf.client.NetconfClientSession;
 import org.opendaylight.netconf.client.NetconfClientSessionListener;
@@ -24,7 +24,7 @@ public interface CallHomeChannelActivator {
      * session negotiation on underlying ssh channel.
      *
      * @param listener Client Session Listener to be attached to NETCONF session.
-     * @return Promise with negotiated NETCONF session
+     * @return Future with negotiated NETCONF session
      */
-    @NonNull Promise<NetconfClientSession> activate(@NonNull NetconfClientSessionListener listener);
+    @NonNull Future<NetconfClientSession> activate(@NonNull NetconfClientSessionListener listener);
 }
index 1c557fd13dcc6e0a0f279ff1676fe27fa1f8cd55..16257a76d202a862531c7bb6c6f9aed38b153442 100644 (file)
@@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.MoreObjects;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import io.netty.util.concurrent.Promise;
+import io.netty.util.concurrent.Future;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.NetconfTerminationReason;
 import org.opendaylight.netconf.callhome.protocol.CallHomeChannelActivator;
@@ -77,7 +77,7 @@ class CallHomeMountSessionContext {
                 .build();
     }
 
-    Promise<NetconfClientSession> activateNetconfChannel(final NetconfClientSessionListener sessionListener) {
+    Future<NetconfClientSession> activateNetconfChannel(final NetconfClientSessionListener sessionListener) {
         return activator.activate(wrap(sessionListener));
     }