Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
- netconf SSH bridge bundle
[controller.git]
/
opendaylight
/
netconf
/
netconf-client
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
client
/
NetconfClientDispatcher.java
diff --git
a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
index d18f0208d4288d87abef3dc7b8de7c1451c1826d..62c2113056afa1611300fce0c363ce293314fb49 100644
(file)
--- a/
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
+++ b/
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
@@
-10,6
+10,7
@@
package org.opendaylight.controller.netconf.client;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.util.HashedWheelTimer;
import io.netty.util.concurrent.Future;
import io.netty.channel.socket.SocketChannel;
import io.netty.util.HashedWheelTimer;
import io.netty.util.concurrent.Future;
@@
-22,19
+23,27
@@
import org.opendaylight.protocol.framework.AbstractDispatcher;
import org.opendaylight.protocol.framework.ReconnectStrategy;
import org.opendaylight.protocol.framework.SessionListener;
import org.opendaylight.protocol.framework.SessionListenerFactory;
import org.opendaylight.protocol.framework.ReconnectStrategy;
import org.opendaylight.protocol.framework.SessionListener;
import org.opendaylight.protocol.framework.SessionListenerFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
+import java.io.Closeable;
import java.net.InetSocketAddress;
import java.net.InetSocketAddress;
-public class NetconfClientDispatcher extends AbstractDispatcher<NetconfClientSession, NetconfClientSessionListener> {
+public class NetconfClientDispatcher extends AbstractDispatcher<NetconfClientSession, NetconfClientSessionListener> implements Closeable {
+
+ private static final Logger logger = LoggerFactory.getLogger(NetconfClient.class);
private final Optional<SSLContext> maybeContext;
private final NetconfClientSessionNegotiatorFactory negotatorFactory;
private final Optional<SSLContext> maybeContext;
private final NetconfClientSessionNegotiatorFactory negotatorFactory;
+ private final HashedWheelTimer timer;
- public NetconfClientDispatcher(final Optional<SSLContext> maybeContext) {
+ public NetconfClientDispatcher(final Optional<SSLContext> maybeContext, EventLoopGroup bossGroup, EventLoopGroup workerGroup) {
+ super(bossGroup, workerGroup);
this.maybeContext = Preconditions.checkNotNull(maybeContext);
this.maybeContext = Preconditions.checkNotNull(maybeContext);
- this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(new HashedWheelTimer());
+ timer = new HashedWheelTimer();
+ this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer);
}
public Future<NetconfClientSession> createClient(InetSocketAddress address,
}
public Future<NetconfClientSession> createClient(InetSocketAddress address,
@@
-81,4
+90,12
@@
public class NetconfClientDispatcher extends AbstractDispatcher<NetconfClientSes
}
}
}
}
+ @Override
+ public void close() {
+ try {
+ timer.stop();
+ } catch (Exception e) {
+ logger.debug("Ignoring exception while closing {}", timer, e);
+ }
+ }
}
}