X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardSnapshotCohort.java;h=455c874229f3c1c86fd6c3fcfc5609a6c81a91bb;hp=0627c0a9e552c1e81bf0e1c5b51177fa03517f0e;hb=e78622411319748472b5d9edab14eb6dc92cf6b1;hpb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java index 0627c0a9e5..455c874229 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015, 2017 Brocade Communications Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -12,7 +12,7 @@ import akka.actor.ActorRef; import com.google.common.base.Preconditions; import com.google.common.io.ByteSource; import java.io.IOException; -import java.io.InputStream; +import java.io.ObjectInputStream; import java.io.OutputStream; import java.util.Optional; import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier; @@ -65,7 +65,10 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort { @Override public void createSnapshot(final ActorRef actorRef, final Optional installSnapshotStream) { // Forward the request to the snapshot actor - ShardSnapshotActor.requestSnapshot(snapshotActor, store.takeStateSnapshot(), installSnapshotStream, actorRef); + final ShardDataTreeSnapshot snapshot = store.takeStateSnapshot(); + log.debug("{}: requesting serialization of snapshot {}", logId, snapshot); + + ShardSnapshotActor.requestSnapshot(snapshotActor, snapshot, installSnapshotStream, actorRef); } @Override @@ -94,9 +97,9 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort { } @Override - public State deserializeSnapshot(ByteSource snapshotBytes) throws IOException { - try (final InputStream is = snapshotBytes.openStream()) { - return new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(is)); + public State deserializeSnapshot(final ByteSource snapshotBytes) throws IOException { + try (ObjectInputStream in = new ObjectInputStream(snapshotBytes.openStream())) { + return new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(in)); } } }