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%2Factors%2FShardSnapshotActor.java;h=4796e1c37f466cb4c2c94c281dbcc4ab0275b47c;hb=2634ed7138a343f051ff6452ccc7edd3abfc0c3a;hp=e7529fb4bfcf3b9f1003fce0c03ae26fd943c3a6;hpb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActor.java index e7529fb4bf..4796e1c37f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/actors/ShardSnapshotActor.java @@ -11,14 +11,13 @@ import akka.actor.ActorRef; import akka.actor.Props; import com.google.common.base.Preconditions; import java.io.IOException; +import java.io.ObjectOutputStream; import java.io.OutputStream; import java.util.Optional; import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActorWithMetering; import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshot; import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState; import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshotReply; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * This is an offload actor, which is given an isolated snapshot of the data tree. It performs the potentially @@ -27,8 +26,6 @@ import org.slf4j.LoggerFactory; * @author Robert Varga */ public final class ShardSnapshotActor extends AbstractUntypedActorWithMetering { - private static final Logger LOG = LoggerFactory.getLogger(ShardSnapshotActor.class); - // Internal message private static final class SerializeSnapshot { private final ShardDataTreeSnapshot snapshot; @@ -71,11 +68,11 @@ public final class ShardSnapshotActor extends AbstractUntypedActorWithMetering { } } - private void onSerializeSnapshot(SerializeSnapshot request) { + private void onSerializeSnapshot(final SerializeSnapshot request) { Optional installSnapshotStream = request.getInstallSnapshotStream(); if (installSnapshotStream.isPresent()) { - try { - request.getSnapshot().serialize(installSnapshotStream.get()); + try (ObjectOutputStream out = new ObjectOutputStream(installSnapshotStream.get())) { + request.getSnapshot().serialize(out); } catch (IOException e) { // TODO - we should communicate the failure in the CaptureSnapshotReply. LOG.error("Error serializing snapshot", e);