X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2FAbstractNetconfSession.java;h=29fe99fcb043dee6d76cf3073b1e7be60d6372c2;hb=4f0f6f3a97b17d1e6914149c4c999d8801596c41;hp=b1c1203c4f1dc5cb295e7ce9c4845c2ab422b90b;hpb=56754e685563cf98a77e2e0772753f95165293b8;p=netconf.git diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSession.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSession.java index b1c1203c4f..29fe99fcb0 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSession.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSession.java @@ -7,28 +7,26 @@ */ package org.opendaylight.netconf.nettyutil; +import com.siemens.ct.exi.core.exceptions.EXIException; +import com.siemens.ct.exi.core.exceptions.UnsupportedOption; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandler; -import io.netty.channel.DefaultChannelPromise; +import io.netty.channel.ChannelPromise; import io.netty.handler.codec.ByteToMessageDecoder; import io.netty.handler.codec.MessageToByteEncoder; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.FutureListener; import java.io.IOException; -import org.opendaylight.controller.config.util.xml.XmlElement; import org.opendaylight.netconf.api.NetconfExiSession; import org.opendaylight.netconf.api.NetconfMessage; import org.opendaylight.netconf.api.NetconfSession; import org.opendaylight.netconf.api.NetconfSessionListener; import org.opendaylight.netconf.api.NetconfTerminationReason; +import org.opendaylight.netconf.api.xml.XmlElement; import org.opendaylight.netconf.nettyutil.handler.NetconfEXICodec; import org.opendaylight.netconf.nettyutil.handler.NetconfEXIToMessageDecoder; import org.opendaylight.netconf.nettyutil.handler.NetconfMessageToEXIEncoder; import org.opendaylight.netconf.nettyutil.handler.exi.EXIParameters; import org.opendaylight.protocol.framework.AbstractProtocolSession; -import org.openexi.proc.common.EXIOptionsException; -import org.openexi.sax.TransmogrifierException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,29 +73,17 @@ public abstract class AbstractNetconfSession() { - @Override - public void operationComplete(Future future) throws Exception { - if (future.isSuccess()) { - proxyFuture.setSuccess(); - } else { - proxyFuture.setFailure(future.cause()); - } - } - }); - if (delayedEncoder != null) { - replaceMessageEncoder(delayedEncoder); - delayedEncoder = null; - } + + final ChannelPromise promise = channel.newPromise(); + channel.eventLoop().execute(() -> { + channel.writeAndFlush(netconfMessage, promise); + if (delayedEncoder != null) { + replaceMessageEncoder(delayedEncoder); + delayedEncoder = null; } }); - return proxyFuture; + return promise; } @Override @@ -147,24 +133,17 @@ public abstract class AbstractNetconfSession