Make negotiationFuture final 87/84987/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 8 Oct 2019 10:28:05 +0000 (12:28 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 8 Oct 2019 10:28:05 +0000 (12:28 +0200)
It is obvious this is field does not change once constructed, make
sure constructors reflect that.

Change-Id: Ib867ba94775c52b241f7044ac6388c4263ad5074
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 0017eff749043fb399edfbf32143dce8aee89fa0..b492028969d3406c2419f5d9ba7e654e4b2ee392 100644 (file)
@@ -51,10 +51,10 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
         DEFAULT_CLIENT = c;
     }
 
+    private final AtomicBoolean isDisconnected = new AtomicBoolean();
     private final AuthenticationHandler authenticationHandler;
     private final SshClient sshClient;
-    private final AtomicBoolean isDisconnected = new AtomicBoolean();
-    private Future<?> negotiationFuture;
+    private final Future<?> negotiationFuture;
 
     private AsyncSshHandlerReader sshReadAsyncListener;
     private AsyncSshHandlerWriter sshWriteAsyncHandler;
@@ -66,7 +66,8 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
 
     public AsyncSshHandler(final AuthenticationHandler authenticationHandler, final SshClient sshClient,
             final Future<?> negotiationFuture) {
-        this(authenticationHandler, sshClient);
+        this.authenticationHandler = requireNonNull(authenticationHandler);
+        this.sshClient = requireNonNull(sshClient);
         this.negotiationFuture = negotiationFuture;
     }
 
@@ -76,10 +77,8 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
      * @param authenticationHandler authentication handler
      * @param sshClient             started SshClient
      */
-    public AsyncSshHandler(final AuthenticationHandler authenticationHandler,
-                           final SshClient sshClient) {
-        this.authenticationHandler = requireNonNull(authenticationHandler);
-        this.sshClient = requireNonNull(sshClient);
+    public AsyncSshHandler(final AuthenticationHandler authenticationHandler, final SshClient sshClient) {
+        this(authenticationHandler, sshClient, null);
     }
 
     public static AsyncSshHandler createForNetconfSubsystem(final AuthenticationHandler authenticationHandler) {