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%2Fshardmanager%2FShardManagerGetSnapshotReplyActor.java;h=c474cf89fc8ee6cf8f35f91b43189a13d332824c;hp=a1628bb37c050b0410f96930d8978c7ca5491450;hb=95c296a7c1e8e186a88a0a0dc82e080b2185db33;hpb=f86f7e8c204fb19615c45e669a764c623576e1a3;ds=sidebyside diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActor.java index a1628bb37c..c474cf89fc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerGetSnapshotReplyActor.java @@ -20,8 +20,9 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeoutException; import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier; -import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot; -import org.opendaylight.controller.cluster.datastore.messages.DatastoreSnapshot.ShardSnapshot; +import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot; +import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot.ShardSnapshot; +import org.opendaylight.controller.cluster.datastore.persisted.ShardManagerSnapshot; import org.opendaylight.controller.cluster.raft.client.messages.GetSnapshotReply; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,18 +52,18 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor { @Override public void onReceive(Object message) { - if(message instanceof GetSnapshotReply) { + if (message instanceof GetSnapshotReply) { onGetSnapshotReply((GetSnapshotReply)message); - } else if(message instanceof Failure) { + } else if (message instanceof Failure) { LOG.debug("{}: Received {}", params.id, message); params.replyToActor.tell(message, getSelf()); getSelf().tell(PoisonPill.getInstance(), getSelf()); } else if (message instanceof ReceiveTimeout) { String msg = String.format( - "Timed out after %s ms while waiting for snapshot replies from %d shard(s). %d shard(s) %s did not respond.", - params.receiveTimeout.toMillis(), params.shardNames.size(), remainingShardNames.size(), - remainingShardNames); + "Timed out after %s ms while waiting for snapshot replies from %d shard(s). %d shard(s) %s " + + "did not respond.", params.receiveTimeout.toMillis(), params.shardNames.size(), + remainingShardNames.size(), remainingShardNames); LOG.warn("{}: {}", params.id, msg); params.replyToActor.tell(new Failure(new TimeoutException(msg)), getSelf()); getSelf().tell(PoisonPill.getInstance(), getSelf()); @@ -72,22 +73,22 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor { private void onGetSnapshotReply(GetSnapshotReply getSnapshotReply) { LOG.debug("{}: Received {}", params.id, getSnapshotReply); - ShardIdentifier shardId = ShardIdentifier.builder().fromShardIdString(getSnapshotReply.getId()).build(); + ShardIdentifier shardId = ShardIdentifier.fromShardIdString(getSnapshotReply.getId()); shardSnapshots.add(new ShardSnapshot(shardId.getShardName(), getSnapshotReply.getSnapshot())); remainingShardNames.remove(shardId.getShardName()); - if(remainingShardNames.isEmpty()) { + if (remainingShardNames.isEmpty()) { LOG.debug("{}: All shard snapshots received", params.id); - DatastoreSnapshot datastoreSnapshot = new DatastoreSnapshot(params.datastoreType, params.shardManagerSnapshot, - shardSnapshots); + DatastoreSnapshot datastoreSnapshot = new DatastoreSnapshot(params.datastoreType, + params.shardManagerSnapshot, shardSnapshots); params.replyToActor.tell(datastoreSnapshot, getSelf()); getSelf().tell(PoisonPill.getInstance(), getSelf()); } } - public static Props props(Collection shardNames, String datastoreType, byte[] shardManagerSnapshot, - ActorRef replyToActor, String id, Duration receiveTimeout) { + public static Props props(Collection shardNames, String datastoreType, + ShardManagerSnapshot shardManagerSnapshot, ActorRef replyToActor, String id, Duration receiveTimeout) { return Props.create(ShardManagerGetSnapshotReplyActor.class, new Params(shardNames, datastoreType, shardManagerSnapshot, replyToActor, id, receiveTimeout)); } @@ -95,13 +96,13 @@ class ShardManagerGetSnapshotReplyActor extends UntypedActor { private static final class Params { final Collection shardNames; final String datastoreType; - final byte[] shardManagerSnapshot; + final ShardManagerSnapshot shardManagerSnapshot; final ActorRef replyToActor; final String id; final Duration receiveTimeout; - Params(Collection shardNames, String datastoreType, byte[] shardManagerSnapshot, ActorRef replyToActor, - String id, Duration receiveTimeout) { + Params(Collection shardNames, String datastoreType, ShardManagerSnapshot shardManagerSnapshot, + ActorRef replyToActor, String id, Duration receiveTimeout) { this.shardNames = shardNames; this.datastoreType = datastoreType; this.shardManagerSnapshot = shardManagerSnapshot;