Skip to content

Commit

Permalink
Refactor SshProxyServer class
Browse files Browse the repository at this point in the history
Adapt SshProxyServer to deal with
apache/mina-sshd#424

JIRA: NETCONF-1267
Change-Id: I254c8fa2563553a22e3197b658bb0c367c51e232
Signed-off-by: Matej Sramcik <matej.sramcik@pantheon.tech>
  • Loading branch information
Sramcik committed Apr 25, 2024
1 parent 7882a8a commit 5c37478
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
import org.opendaylight.netconf.shaded.sshd.common.io.IoServiceEventListener;
import org.opendaylight.netconf.shaded.sshd.common.io.IoServiceFactory;
import org.opendaylight.netconf.shaded.sshd.common.io.IoServiceFactoryFactory;
import org.opendaylight.netconf.shaded.sshd.common.io.nio2.Nio2Acceptor;
import org.opendaylight.netconf.shaded.sshd.common.io.nio2.Nio2Connector;
import org.opendaylight.netconf.shaded.sshd.common.io.nio2.Nio2ServiceFactory;
import org.opendaylight.netconf.shaded.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
import org.opendaylight.netconf.shaded.sshd.common.session.SessionHeartbeatController.HeartbeatType;
import org.opendaylight.netconf.shaded.sshd.common.util.closeable.AbstractCloseable;
import org.opendaylight.netconf.shaded.sshd.common.util.threads.NoCloseExecutor;
import org.opendaylight.netconf.shaded.sshd.core.CoreModuleProperties;
import org.opendaylight.netconf.shaded.sshd.server.SshServer;

Expand Down Expand Up @@ -127,16 +127,16 @@ public void close() throws IOException {
}

private abstract static class AbstractNioServiceFactory extends AbstractCloseable implements IoServiceFactory {
private final FactoryManager manager;
private final AsynchronousChannelGroup group;
private final ExecutorService resumeTasks;
private final Nio2ServiceFactory serviceFactory;
private IoServiceEventListener eventListener;

AbstractNioServiceFactory(final FactoryManager manager, final AsynchronousChannelGroup group,
final ExecutorService resumeTasks) {
this.manager = requireNonNull(manager);
this.group = requireNonNull(group);
this.resumeTasks = requireNonNull(resumeTasks);
serviceFactory = new Nio2ServiceFactory(manager, null, new NoCloseExecutor(resumeTasks));
}

final AsynchronousChannelGroup group() {
Expand All @@ -149,12 +149,12 @@ final ExecutorService resumeTasks() {

@Override
public final IoConnector createConnector(final IoHandler handler) {
return new Nio2Connector(manager, handler, group, resumeTasks);
return serviceFactory.createConnector(handler);
}

@Override
public final IoAcceptor createAcceptor(final IoHandler handler) {
return new Nio2Acceptor(manager, handler, group, resumeTasks);
return serviceFactory.createAcceptor(handler);
}

@Override
Expand Down

0 comments on commit 5c37478

Please sign in to comment.