Clean up onUnderlayChannelEstablished 25/107925/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 20 Sep 2023 10:50:23 +0000 (12:50 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 20 Sep 2023 10:51:37 +0000 (12:51 +0200)
Drop unneeded annotation and clean up method implementation.

JIRA: NETCONF-590
Change-Id: Ib0cd36c0a41b32e380dd0e1484d0fec58895020f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
transport/transport-ssh/src/main/java/org/opendaylight/netconf/transport/ssh/SSHTransportStack.java

index 44a17cd20384d4cb7d345e8f4b2bc5e4ec516845..6b5faf77332ebed3ef57d4bd57afdb31c38034f5 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.netconf.transport.ssh;
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.netconf.shaded.sshd.common.io.IoHandler;
 import org.opendaylight.netconf.shaded.sshd.common.session.Session;
 import org.opendaylight.netconf.shaded.sshd.netty.NettyIoService;
@@ -24,7 +23,6 @@ import org.opendaylight.netconf.transport.api.TransportStack;
  */
 public abstract sealed class SSHTransportStack extends AbstractOverlayTransportStack<SSHTransportChannel>
         permits SSHClient, SSHServer {
-
     protected final Map<Long, UserAuthSessionListener.AuthHandler> sessionAuthHandlers = new ConcurrentHashMap<>();
     protected final Map<Long, Session> sessions = new ConcurrentHashMap<>();
     protected NettyIoService ioService;
@@ -34,14 +32,16 @@ public abstract sealed class SSHTransportStack extends AbstractOverlayTransportS
     }
 
     @Override
-    protected void onUnderlayChannelEstablished(@NonNull TransportChannel underlayChannel) {
-        var channel = underlayChannel.channel();
-        final SshIoSession ioSession = new SshIoSession(ioService, getSessionFactory(), channel.localAddress());
+    protected void onUnderlayChannelEstablished(final TransportChannel underlayChannel) {
+        final var channel = underlayChannel.channel();
+        final var ioSession = new SshIoSession(ioService, getSessionFactory(), channel.localAddress());
         channel.pipeline().addLast(ioSession.getHandler());
         // authentication triggering and handlers processing is performed by UserAuthSessionListener
         sessionAuthHandlers.put(ioSession.getId(), new UserAuthSessionListener.AuthHandler(
-                () -> addTransportChannel(new SSHTransportChannel(underlayChannel)), // auth success
-                () -> channel.close()) // auth failure
+            // auth success
+            () -> addTransportChannel(new SSHTransportChannel(underlayChannel)),
+            // auth failure
+            () -> channel.close())
         );
     }