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%2Fbehaviors%2FSyncStatusTracker.java;h=2b700ffc43c1ec80cce36f2ab4293cfaebc09547;hb=86e8e4a06b682aa772c834a2cef56d0596540e1b;hp=e2512d5b67f911acfab9e8d94e3c5f4888381714;hpb=8b24b0354ca9db35631d85a2b32d2419157c2a3e;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SyncStatusTracker.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SyncStatusTracker.java index e2512d5b67..2b700ffc43 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SyncStatusTracker.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/SyncStatusTracker.java @@ -5,11 +5,12 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.raft.behaviors; +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorRef; -import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.raft.base.messages.FollowerInitialSyncUpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +29,7 @@ public class SyncStatusTracker { final String leaderId; LeaderInfo(final String leaderId, final long minimumCommitIndex) { - this.leaderId = Preconditions.checkNotNull(leaderId); + this.leaderId = requireNonNull(leaderId); this.minimumCommitIndex = minimumCommitIndex; } } @@ -46,14 +47,14 @@ public class SyncStatusTracker { private boolean syncStatus; public SyncStatusTracker(final ActorRef actor, final String id, final long syncThreshold) { - this.actor = Preconditions.checkNotNull(actor, "actor should not be null"); - this.id = Preconditions.checkNotNull(id, "id should not be null"); - Preconditions.checkArgument(syncThreshold >= 0, "syncThreshold should be greater than or equal to 0"); + this.actor = requireNonNull(actor, "actor should not be null"); + this.id = requireNonNull(id, "id should not be null"); + checkArgument(syncThreshold >= 0, "syncThreshold should be greater than or equal to 0"); this.syncThreshold = syncThreshold; } public void update(final String leaderId, final long leaderCommit, final long commitIndex) { - Preconditions.checkNotNull(leaderId, "leaderId should not be null"); + requireNonNull(leaderId, "leaderId should not be null"); if (syncTarget == null || !leaderId.equals(syncTarget.leaderId)) { LOG.debug("{}: Last sync leader does not match current leader {}, need to catch up to {}", id, @@ -68,7 +69,7 @@ public class SyncStatusTracker { LOG.debug("{}: Lagging {} entries behind leader {}", id, lag, leaderId); changeSyncStatus(NOT_IN_SYNC, false); } else if (commitIndex >= syncTarget.minimumCommitIndex) { - LOG.debug("{}: Lagging {} entries behind leader and reached {} (of expected {})", id, lag, leaderId, + LOG.debug("{}: Lagging {} entries behind leader {} and reached {} (of expected {})", id, lag, leaderId, commitIndex, syncTarget.minimumCommitIndex); changeSyncStatus(IN_SYNC, false); }