import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
import org.opendaylight.controller.netconf.client.NetconfClient;
+import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
+import javax.net.ssl.SSLContext;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationHandler.class);
private final InetSocketAddress address;
+ private final NetconfClientDispatcher dispatcher;
private NetconfClient netconfClient;
this.address = address;
this.mbeanServer = mbeanServer;
this.timeout = timeout;
+ this.dispatcher = new NetconfClientDispatcher(Optional.<SSLContext>absent());
}
public void init() throws InterruptedException {
attempt++;
try {
- netconfClient = new NetconfClient(this.toString(), address, delay);
+ netconfClient = new NetconfClient(this.toString(), address, delay, dispatcher);
// TODO is this correct ex to catch ?
} catch (IllegalStateException e) {
logger.debug("Netconf {} was not initialized or is not stable, attempt {}", address, attempt, e);
}
}
+ try {
+ dispatcher.close();
+ } catch (Exception e) {
+ logger.warn("Unable to close netconf client dispatcher {}", dispatcher, e);
+ }
+
// unregister from JMX
try {
if (mbeanServer.isRegistered(on)) {