X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActorContextImpl.java;h=634bbd4343fbba9219a8ab7a81c22c96c1ebf16c;hp=9c8fbe496cd96462b38fa798b0d3001943b5f4c5;hb=b4bf55727093657662d8c16a50fa85f87978a586;hpb=9d4ff4c4045fdef38e3940d336d2825df29c4d65 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java index 9c8fbe496c..634bbd4343 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java @@ -5,9 +5,10 @@ * 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; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorContext; import akka.actor.ActorRef; import akka.actor.ActorSelection; @@ -15,7 +16,6 @@ import akka.actor.ActorSystem; import akka.actor.Props; import akka.cluster.Cluster; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -26,8 +26,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Consumer; import java.util.function.LongSupplier; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.controller.cluster.DataPersistenceProvider; import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory; import org.opendaylight.controller.cluster.raft.base.messages.ApplyState; @@ -94,25 +93,25 @@ public class RaftActorContextImpl implements RaftActorContext { private RaftActorLeadershipTransferCohort leadershipTransferCohort; public RaftActorContextImpl(final ActorRef actor, final ActorContext context, final String id, - @Nonnull final ElectionTerm termInformation, final long commitIndex, final long lastApplied, - @Nonnull final Map peerAddresses, - @Nonnull final ConfigParams configParams, @Nonnull final DataPersistenceProvider persistenceProvider, - @Nonnull final Consumer applyStateConsumer, @Nonnull final Logger logger) { + final @NonNull ElectionTerm termInformation, final long commitIndex, final long lastApplied, + final @NonNull Map peerAddresses, + final @NonNull ConfigParams configParams, final @NonNull DataPersistenceProvider persistenceProvider, + final @NonNull Consumer applyStateConsumer, final @NonNull Logger logger) { this.actor = actor; this.context = context; this.id = id; - this.termInformation = Preconditions.checkNotNull(termInformation); + this.termInformation = requireNonNull(termInformation); this.commitIndex = commitIndex; this.lastApplied = lastApplied; - this.configParams = Preconditions.checkNotNull(configParams); - this.persistenceProvider = Preconditions.checkNotNull(persistenceProvider); - this.log = Preconditions.checkNotNull(logger); - this.applyStateConsumer = Preconditions.checkNotNull(applyStateConsumer); + this.configParams = requireNonNull(configParams); + this.persistenceProvider = requireNonNull(persistenceProvider); + this.log = requireNonNull(logger); + this.applyStateConsumer = requireNonNull(applyStateConsumer); fileBackedOutputStreamFactory = new FileBackedOutputStreamFactory( configParams.getFileBackedStreamingThreshold(), configParams.getTempFileDirectory()); - for (Map.Entry e: Preconditions.checkNotNull(peerAddresses).entrySet()) { + for (Map.Entry e : requireNonNull(peerAddresses).entrySet()) { peerInfoMap.put(e.getKey(), new PeerInfo(e.getKey(), e.getValue(), VotingState.VOTING)); } } @@ -404,7 +403,7 @@ public class RaftActorContextImpl implements RaftActorContext { } void setCurrentBehavior(final RaftActorBehavior behavior) { - this.currentBehavior = Preconditions.checkNotNull(behavior); + this.currentBehavior = requireNonNull(behavior); } @Override @@ -429,15 +428,13 @@ public class RaftActorContextImpl implements RaftActorContext { } @Override - @Nullable public RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort() { return leadershipTransferCohort; } @Override @SuppressWarnings("checkstyle:hiddenField") - public void setRaftActorLeadershipTransferCohort( - @Nullable final RaftActorLeadershipTransferCohort leadershipTransferCohort) { + public void setRaftActorLeadershipTransferCohort(final RaftActorLeadershipTransferCohort leadershipTransferCohort) { this.leadershipTransferCohort = leadershipTransferCohort; } }