X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpersisted%2FShardDataTreeSnapshot.java;h=7ae9fa288679601f2c17c8708f668808fdfd8ab4;hb=1d5ca4009be6c61d7b61989799037ad8f1ab7a75;hp=1dbab16c7ba118586040e196d43dc4cdeef636a8;hpb=ff818d5df82e34d0031289901e0335fe15c91303;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java index 1dbab16c7b..7ae9fa2886 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/ShardDataTreeSnapshot.java @@ -8,16 +8,12 @@ package org.opendaylight.controller.cluster.datastore.persisted; import com.google.common.annotations.Beta; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; import java.io.IOException; -import java.io.InputStream; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Abstract base class for snapshots of the ShardDataTree. @@ -26,32 +22,12 @@ import org.slf4j.LoggerFactory; */ @Beta public abstract class ShardDataTreeSnapshot { - private static final Logger LOG = LoggerFactory.getLogger(ShardDataTreeSnapshot.class); - ShardDataTreeSnapshot() { // Hidden to prevent subclassing from outside of this package } - @Deprecated - public static ShardDataTreeSnapshot deserializePreCarbon(final byte[] bytes) throws IOException { - try (InputStream is = new ByteArrayInputStream(bytes)) { - try (DataInputStream dis = new DataInputStream(is)) { - final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.deserializePreCarbon(dis); - - // Make sure we consume all bytes, otherwise something went very wrong - final int bytesLeft = dis.available(); - if (bytesLeft != 0) { - throw new IOException("Deserialization left " + bytesLeft + " in the buffer"); - } - - - return ret; - } - } - } - - public static ShardDataTreeSnapshot deserialize(final ObjectInput in) throws IOException { - final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.versionedDeserialize(in); + public static @NonNull ShardSnapshotState deserialize(final ObjectInput in) throws IOException { + final ShardSnapshotState ret = AbstractVersionedShardDataTreeSnapshot.versionedDeserialize(in); // Make sure we consume all bytes, otherwise something went very wrong final int bytesLeft = in.available(); @@ -59,7 +35,6 @@ public abstract class ShardDataTreeSnapshot { throw new IOException("Deserialization left " + bytesLeft + " in the buffer"); } - return ret; } @@ -68,7 +43,7 @@ public abstract class ShardDataTreeSnapshot { * * @return An optional root node. */ - public abstract Optional> getRootNode(); + public abstract Optional getRootNode(); public abstract void serialize(ObjectOutput out) throws IOException; }