X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbase%2Fmessages%2FCaptureSnapshotReply.java;h=552c7df22d8e10401384c993deb2988714d90f81;hb=refs%2Fchanges%2F11%2F80211%2F6;hp=1e573014a9ed6596ae6af84df0f724a9e730c34c;hpb=97542f208267cb5392fc8c8d9baf6c1d3ee4ae32;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java index 1e573014a9..552c7df22d 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java @@ -7,22 +7,29 @@ */ package org.opendaylight.controller.cluster.raft.base.messages; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import static java.util.Objects.requireNonNull; -public class CaptureSnapshotReply { - private final byte [] snapshot; +import akka.dispatch.ControlMessage; +import java.io.OutputStream; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.controller.cluster.raft.persisted.Snapshot; - @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "Stores a reference to an externally mutable byte[] " - + "object but this is OK since this class is merely a DTO and does not process byte[] internally. " - + "Also it would be inefficient to create a copy as the byte[] could be large.") - public CaptureSnapshotReply(byte [] snapshot) { - this.snapshot = snapshot; +public class CaptureSnapshotReply implements ControlMessage { + private final Snapshot.State snapshotState; + private final Optional installSnapshotStream; + + public CaptureSnapshotReply(final Snapshot.@NonNull State snapshotState, + final @NonNull Optional installSnapshotStream) { + this.snapshotState = requireNonNull(snapshotState); + this.installSnapshotStream = requireNonNull(installSnapshotStream); + } + + public Snapshot.@NonNull State getSnapshotState() { + return snapshotState; } - @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but " - + "this is OK since this class is merely a DTO and does not process the byte[] internally. " - + "Also it would be inefficient to create a return copy as the byte[] could be large.") - public byte [] getSnapshot() { - return snapshot; + public @NonNull Optional getInstallSnapshotStream() { + return installSnapshotStream; } }