Invert equals() invocation for expired TX_COMMIT_TIMEOUT_CHECK_MESSAGE 00/36900/3
authorRobert Varga <rovarga@cisco.com>
Wed, 30 Mar 2016 15:09:16 +0000 (17:09 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 31 Mar 2016 08:22:44 +0000 (10:22 +0200)
TX_COMMIT_TIMEOUT_CHECK_MESSAGE is a constant, hence calling equals on it
with the message parameter should be faster than the over way around.

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

index 6030117..ccd0b85 100644 (file)
@@ -244,7 +244,7 @@ public class Shard extends RaftActor {
                 PeerAddressResolved resolved = (PeerAddressResolved) message;
                 setPeerAddress(resolved.getPeerId().toString(),
                         resolved.getPeerAddress());
-            } else if (message.equals(TX_COMMIT_TIMEOUT_CHECK_MESSAGE)) {
+            } else if (TX_COMMIT_TIMEOUT_CHECK_MESSAGE.equals(message)) {
                 commitCoordinator.checkForExpiredTransactions(transactionCommitTimeout, this);
             } else if(message instanceof DatastoreContext) {
                 onDatastoreContext((DatastoreContext)message);