Use instanceof instead of .class.isInstance() 98/36298/2
authorRobert Varga <rovarga@cisco.com>
Wed, 16 Mar 2016 15:16:35 +0000 (16:16 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 21 Mar 2016 11:11:43 +0000 (11:11 +0000)
These two are equivalent and using instanceof is more consistent with the rest
of the code.

Change-Id: I0493a94a09f66e19afb503afd05682692fba1b40
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java

index 63bf14922a1b1c10acab2f0f37543c004f52d99d..86caf2a10e6650dd45d9953458127b43adda0620 100644 (file)
@@ -1043,7 +1043,7 @@ public class FollowerTest extends AbstractRaftActorBehaviorTest {
             ActorRef actorRef, RaftRPC rpc) throws Exception {
         super.assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(actorContext, actorRef, rpc);
 
-        String expVotedFor = RequestVote.class.isInstance(rpc) ? ((RequestVote)rpc).getCandidateId() : null;
+        String expVotedFor = rpc instanceof RequestVote ? ((RequestVote)rpc).getCandidateId() : null;
         assertEquals("New votedFor", expVotedFor, actorContext.getTermInformation().getVotedFor());
     }
 
index fdf00c6fff9f20f8eb349ea108d3f97d1d642235..72b31d5598d80aaf7f7961e33c562d72dbbb7bc1 100644 (file)
@@ -219,7 +219,7 @@ public class Shard extends RaftActor {
         try {
             if (CreateTransaction.isSerializedType(message)) {
                 handleCreateTransaction(message);
-            } else if (BatchedModifications.class.isInstance(message)) {
+            } else if (message instanceof BatchedModifications) {
                 handleBatchedModifications((BatchedModifications)message);
             } else if (message instanceof ForwardedReadyTransaction) {
                 handleForwardedReadyTransaction((ForwardedReadyTransaction) message);