*/
package org.opendaylight.controller.cluster.datastore;
+import static java.util.Objects.requireNonNull;
+
import akka.actor.ActorContext;
import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
import com.google.common.io.ByteSource;
import java.io.IOException;
import java.io.ObjectInputStream;
*
* @author Thomas Pantelis
*/
-class ShardSnapshotCohort implements RaftActorSnapshotCohort {
+final class ShardSnapshotCohort implements RaftActorSnapshotCohort {
private static final FrontendType SNAPSHOT_APPLY = FrontendType.forName("snapshot-apply");
private final ActorRef snapshotActor;
private ShardSnapshotCohort(final LocalHistoryIdentifier applyHistoryId, final ActorRef snapshotActor,
final ShardDataTree store, final Logger log, final String logId) {
- this.snapshotActor = Preconditions.checkNotNull(snapshotActor);
- this.store = Preconditions.checkNotNull(store);
+ this.snapshotActor = requireNonNull(snapshotActor);
+ this.store = requireNonNull(store);
this.log = log;
this.logId = logId;
}
@SuppressWarnings("checkstyle:IllegalCatch")
public void applySnapshot(final Snapshot.State snapshotState) {
if (!(snapshotState instanceof ShardSnapshotState)) {
- log.debug("{}: applySnapshot ignoring snapshot: {}", snapshotState);
+ log.debug("{}: applySnapshot ignoring snapshot: {}", logId, snapshotState);
}
final ShardDataTreeSnapshot snapshot = ((ShardSnapshotState)snapshotState).getSnapshot();
@Override
public State deserializeSnapshot(final ByteSource snapshotBytes) throws IOException {
try (ObjectInputStream in = new ObjectInputStream(snapshotBytes.openStream())) {
- return new ShardSnapshotState(ShardDataTreeSnapshot.deserialize(in));
+ return ShardDataTreeSnapshot.deserialize(in);
}
}
}