Reduce reliance on NormalizedNodeInputStreamReader 51/34851/2
authorRobert Varga <rovarga@cisco.com>
Wed, 17 Feb 2016 16:55:57 +0000 (17:55 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 18 Feb 2016 20:32:09 +0000 (20:32 +0000)
Use NormalizedNodeDataInput instead.

Change-Id: I8c16fcdd1f69354a2616fe89b5a368feea1d3090
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/SerializationUtils.java

index 6867f46..97231dc 100644 (file)
@@ -15,6 +15,7 @@ import java.io.ObjectOutput;
 import java.util.Map;
 import java.util.Set;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataInput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeInputOutput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeInputStreamReader;
@@ -45,7 +46,7 @@ public class DataChanged implements Externalizable {
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         in.readShort(); // Read the version
 
-        NormalizedNodeInputStreamReader streamReader = new NormalizedNodeInputStreamReader(in);
+        NormalizedNodeDataInput streamReader = new NormalizedNodeInputStreamReader(in);
 
         // Note: the scope passed to builder is not actually used.
         Builder builder = DOMImmutableDataChangeEvent.builder(DataChangeScope.SUBTREE);
index b416b92..5f84f54 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 public final class SerializationUtils {
     public static final ThreadLocal<NormalizedNodeDataOutput> REUSABLE_WRITER_TL = new ThreadLocal<>();
-    public static final ThreadLocal<NormalizedNodeInputStreamReader> REUSABLE_READER_TL = new ThreadLocal<>();
+    public static final ThreadLocal<NormalizedNodeDataInput> REUSABLE_READER_TL = new ThreadLocal<>();
 
     public static interface Applier<T> {
         void apply(T instance, YangInstanceIdentifier path, NormalizedNode<?, ?> node);
@@ -49,12 +49,12 @@ public final class SerializationUtils {
     }
 
     private static NormalizedNodeDataInput streamReader(DataInput in) throws IOException {
-        NormalizedNodeInputStreamReader streamWriter = REUSABLE_READER_TL.get();
-        if(streamWriter == null) {
-            streamWriter = new NormalizedNodeInputStreamReader(in);
+        NormalizedNodeDataInput streamReader = REUSABLE_READER_TL.get();
+        if(streamReader == null) {
+            streamReader = new NormalizedNodeInputStreamReader(in);
         }
 
-        return streamWriter;
+        return streamReader;
     }
 
     public static void serializePathAndNode(YangInstanceIdentifier path, NormalizedNode<?, ?> node,