Java 8 gives us a Objects.equals(), so stop using Guava.
Change-Id: I319d01c3d1d8abeaa2da4a38286e024f3055996b
Signed-off-by: Robert Varga <rovarga@cisco.com>
import akka.actor.PoisonPill;
import akka.japi.Procedure;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
// it can happen that the state has not changed but the leader has changed.
Optional<ActorRef> roleChangeNotifier = getRoleChangeNotifier();
- if(!Objects.equal(lastValidLeaderId, currentBehavior.getLeaderId()) ||
+ if(!Objects.equals(lastValidLeaderId, currentBehavior.getLeaderId()) ||
oldBehaviorState.getLeaderPayloadVersion() != currentBehavior.getLeaderPayloadVersion()) {
if(roleChangeNotifier.isPresent()) {
roleChangeNotifier.get().tell(newLeaderStateChanged(getId(), currentBehavior.getLeaderId(),
LOG.debug("{}: RaftPolicy used with prev.config {}, RaftPolicy used with newConfig {}", persistenceId(),
oldRaftPolicy, newRaftPolicy);
context.setConfigParams(configParams);
- if (!Objects.equal(oldRaftPolicy, newRaftPolicy)) {
+ if (!Objects.equals(oldRaftPolicy, newRaftPolicy)) {
// The RaftPolicy was modified. If the current behavior is Follower then re-initialize to Follower
// but transfer the previous leaderId so it doesn't immediately try to schedule an election. This
// avoids potential disruption. Otherwise, switch to Follower normally.
package org.opendaylight.controller.cluster.datastore.entityownership;
import static org.opendaylight.controller.cluster.datastore.entityownership.EntityOwnersModel.createEntity;
-import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import java.util.Collection;
+import java.util.Objects;
import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
LOG.debug("{}: New owner: {}, Original owner: {}", logId(), newOwner, origOwner);
- if(!Objects.equal(origOwner, newOwner)) {
- boolean isOwner = Objects.equal(localMemberName, newOwner);
- boolean wasOwner = Objects.equal(localMemberName, origOwner);
+ if(!Objects.equals(origOwner, newOwner)) {
+ boolean isOwner = Objects.equals(localMemberName, newOwner);
+ boolean wasOwner = Objects.equals(localMemberName, origOwner);
boolean hasOwner = !Strings.isNullOrEmpty(newOwner);
Entity entity = createEntity(change.getRootPath());
import akka.actor.ActorRef;
import akka.actor.Props;
import akka.serialization.Serialization;
-import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import javax.annotation.Nullable;
import org.opendaylight.controller.cluster.datastore.DatastoreContext;
}
boolean isLeader() {
- return Objects.equal(leaderId, shardId.toString());
+ return Objects.equals(leaderId, shardId.toString());
}
String getSerializedLeaderActor() {
}
boolean setLeaderId(String leaderId) {
- boolean changed = !Objects.equal(this.leaderId, leaderId);
+ boolean changed = !Objects.equals(this.leaderId, leaderId);
this.leaderId = leaderId;
if(leaderId != null) {
this.leaderAvailable = true;
import akka.util.Timeout;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
-import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.CheckedFuture;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.Before;
}
}
- for(int i = 0; i < expReplies.length; i++) {
- Object expReply = expReplies[i];
+ for (Object expReply : expReplies) {
boolean found = false;
Iterator<?> iter = futureResults.iterator();
while(iter.hasNext()) {
if(CommitTransactionReply.isSerializedType(expReply) &&
CommitTransactionReply.isSerializedType(actual)) {
found = true;
- } else if(expReply instanceof ActorSelection && Objects.equal(expReply, actual)) {
+ } else if(expReply instanceof ActorSelection && Objects.equals(expReply, actual)) {
found = true;
} else if(expReply instanceof Class && ((Class<?>)expReply).isInstance(actual)) {
found = true;