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 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;
SerializeSnapshot(final ShardDataTreeSnapshot snapshot, final Optional<OutputStream> installSnapshotStream,
final ActorRef replyTo) {
SerializeSnapshot(final ShardDataTreeSnapshot snapshot, final Optional<OutputStream> installSnapshotStream,
final ActorRef replyTo) {
- this.snapshot = Preconditions.checkNotNull(snapshot);
- this.installSnapshotStream = Preconditions.checkNotNull(installSnapshotStream);
- this.replyTo = Preconditions.checkNotNull(replyTo);
+ this.snapshot = requireNonNull(snapshot);
+ this.installSnapshotStream = requireNonNull(installSnapshotStream);
+ this.replyTo = requireNonNull(replyTo);
//actor name override used for metering. This does not change the "real" actor name
private static final String ACTOR_NAME_FOR_METERING = "shard-snapshot";
//actor name override used for metering. This does not change the "real" actor name
private static final String ACTOR_NAME_FOR_METERING = "shard-snapshot";
Optional<OutputStream> installSnapshotStream = request.getInstallSnapshotStream();
if (installSnapshotStream.isPresent()) {
Optional<OutputStream> installSnapshotStream = request.getInstallSnapshotStream();
if (installSnapshotStream.isPresent()) {
} catch (IOException e) {
// TODO - we should communicate the failure in the CaptureSnapshotReply.
LOG.error("Error serializing snapshot", e);
} catch (IOException e) {
// TODO - we should communicate the failure in the CaptureSnapshotReply.
LOG.error("Error serializing snapshot", e);
snapshotActor.tell(new SerializeSnapshot(snapshot, installSnapshotStream, replyTo), ActorRef.noSender());
}
snapshotActor.tell(new SerializeSnapshot(snapshot, installSnapshotStream, replyTo), ActorRef.noSender());
}
- public static Props props() {
- return Props.create(ShardSnapshotActor.class);
+ public static Props props(final InputOutputStreamFactory streamFactory) {
+ return Props.create(ShardSnapshotActor.class, streamFactory);