X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-ssh%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fssh%2Fosgi%2FNetconfSSHActivator.java;h=f31f7b95b1ed93cb0d81e202ee5b5ab99f5f54da;hb=0514dcdfb6aab34bd345c15e36ea3dd7fa1ce053;hp=537ea993d1b113b5b46d76b06fd777ed13dca151;hpb=c42de0bce0d26b51da338ca22a694a14c2537b4a;p=netconf.git diff --git a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/osgi/NetconfSSHActivator.java b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/osgi/NetconfSSHActivator.java index 537ea993d1..f31f7b95b1 100644 --- a/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/osgi/NetconfSSHActivator.java +++ b/netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/osgi/NetconfSSHActivator.java @@ -23,6 +23,7 @@ import org.opendaylight.netconf.util.osgi.NetconfConfigUtil; import org.opendaylight.netconf.util.osgi.NetconfConfiguration; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,11 +43,11 @@ public class NetconfSSHActivator implements BundleActivator { private SshProxyServer server; @Override - public void start(final BundleContext bundleContext) throws IOException { + public void start(final BundleContext bundleContext) throws IOException, InvalidSyntaxException { minaTimerExecutor = Executors.newScheduledThreadPool(POOL_SIZE, new ThreadFactory() { @Override - public Thread newThread(final Runnable r) { - return new Thread(r, "netconf-ssh-server-mina-timers"); + public Thread newThread(final Runnable runnable) { + return new Thread(runnable, "netconf-ssh-server-mina-timers"); } }); clientGroup = new NioEventLoopGroup(); @@ -60,26 +61,27 @@ public class NetconfSSHActivator implements BundleActivator { server.close(); } - if(authProviderTracker != null) { + if (authProviderTracker != null) { authProviderTracker.stop(); } - if(nioExecutor!=null) { + if (nioExecutor != null) { nioExecutor.shutdownNow(); } - if(clientGroup != null) { + if (clientGroup != null) { clientGroup.shutdownGracefully(); } - if(minaTimerExecutor != null) { + if (minaTimerExecutor != null) { minaTimerExecutor.shutdownNow(); } } - private SshProxyServer startSSHServer(final BundleContext bundleContext) throws IOException { - final NetconfConfiguration netconfConfiguration = NetconfConfigUtil.getNetconfConfigurationService(bundleContext). - orElseThrow(() -> new IllegalStateException("Configuration for SSH not found.")); + private SshProxyServer startSSHServer(final BundleContext bundleContext) + throws IOException, InvalidSyntaxException { + final NetconfConfiguration netconfConfiguration = + NetconfConfigUtil.getNetconfConfigurationService(bundleContext); final InetSocketAddress sshSocketAddress = netconfConfiguration.getSshServerAddress(); LOG.info("Starting netconf SSH server at {}", sshSocketAddress);