Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Split message aggregators
[controller.git]
/
opendaylight
/
netconf
/
netconf-util
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
util
/
handler
/
NetconfEOMAggregator.java
diff --git
a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java
similarity index 79%
rename from
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
rename to
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java
index a2486050f9368e7ff37314a1e65e38e7134406ed..9435e6ff732cad7904a8fc71caf6ed9ee194225a 100644
(file)
--- a/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageAggregator.java
+++ b/
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java
@@
-8,32
+8,24
@@
package org.opendaylight.controller.netconf.util.handler;
package org.opendaylight.controller.netconf.util.handler;
-import com.google.common.base.Charsets;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
-import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.List;
-public class NetconfMessageAggregator extends ByteToMessageDecoder {
-
-
private final static Logger logger = LoggerFactory.getLogger(NetconfMessageAggregator.class)
;
+import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants;
+import org.slf4j.Logger;
+
import org.slf4j.LoggerFactory
;
-
private byte[] eom = NetconfMessageConstants.endOfMessage
;
+
import com.google.common.base.Charsets
;
- public NetconfMessageAggregator(FramingMechanism framingMechanism) {
- if (framingMechanism == FramingMechanism.CHUNK) {
- eom = NetconfMessageConstants.endOfChunk;
- }
- }
+public class NetconfEOMAggregator extends ByteToMessageDecoder {
+ private final static Logger logger = LoggerFactory.getLogger(NetconfEOMAggregator.class);
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
- int index = indexOfSequence(in,
eom
);
+ int index = indexOfSequence(in,
NetconfMessageConstants.END_OF_MESSAGE
);
if (index == -1) {
logger.debug("Message is not complete, read again.");
if (logger.isTraceEnabled()) {
if (index == -1) {
logger.debug("Message is not complete, read again.");
if (logger.isTraceEnabled()) {
@@
-43,7
+35,7
@@
public class NetconfMessageAggregator extends ByteToMessageDecoder {
ctx.read();
} else {
ByteBuf msg = in.readBytes(index);
ctx.read();
} else {
ByteBuf msg = in.readBytes(index);
- in.readBytes(
eom
.length);
+ in.readBytes(
NetconfMessageConstants.END_OF_MESSAGE
.length);
in.discardReadBytes();
logger.debug("Message is complete.");
out.add(msg);
in.discardReadBytes();
logger.debug("Message is complete.");
out.add(msg);