Reduce reliance on NormalizedNodeInputStreamReader
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / SerializationUtils.java
index b416b922de75be07c9b1e392dd21757444ddcde9..5f84f54b74f30e173c0b77af72178b6daffdfc9e 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,