import java.util.ArrayList;
import java.util.List;
import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshot;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshot;
import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState;
import org.opendaylight.controller.cluster.raft.Snapshot;
import org.opendaylight.controller.cluster.raft.persisted.EmptyState;
import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState;
import org.opendaylight.controller.cluster.raft.Snapshot;
import org.opendaylight.controller.cluster.raft.persisted.EmptyState;
new ArrayList<>(size());
for (DatastoreSnapshot legacy: this) {
snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot(
new ArrayList<>(size());
for (DatastoreSnapshot legacy: this) {
snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot(
- legacy.getType(), legacy.getShardManagerSnapshot(), fromLegacy(legacy.getShardSnapshots())));
+ legacy.getType(), deserializeShardManagerSnapshot(legacy.getShardManagerSnapshot()),
+ fromLegacy(legacy.getShardSnapshots())));
+ private static org.opendaylight.controller.cluster.datastore.persisted.ShardManagerSnapshot
+ deserializeShardManagerSnapshot(byte [] bytes) throws IOException, ClassNotFoundException {
+ if (bytes == null) {
+ return null;
+ }
+
+ try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
+ return (ShardManagerSnapshot) ois.readObject();
+ }
+ }
+
private static List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot>
fromLegacy(List<DatastoreSnapshot.ShardSnapshot> from) throws IOException, ClassNotFoundException {
List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot> snapshots =
new ArrayList<>(from.size());
for (DatastoreSnapshot.ShardSnapshot legacy: from) {
snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot(
private static List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot>
fromLegacy(List<DatastoreSnapshot.ShardSnapshot> from) throws IOException, ClassNotFoundException {
List<org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot> snapshots =
new ArrayList<>(from.size());
for (DatastoreSnapshot.ShardSnapshot legacy: from) {
snapshots.add(new org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot(
throws IOException, ClassNotFoundException {
try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
Snapshot legacy = (Snapshot) ois.readObject();
throws IOException, ClassNotFoundException {
try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
Snapshot legacy = (Snapshot) ois.readObject();