Initialized visitedAddresses to a smaller list 54/36654/4
authorRobert Varga <rovarga@cisco.com>
Wed, 23 Mar 2016 15:37:04 +0000 (16:37 +0100)
committerTom Pantelis <tpanteli@brocade.com>
Tue, 29 Mar 2016 18:30:38 +0000 (18:30 +0000)
Adds final keyword to force initialization and provide a hint that
the list will have a single entry.

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

index 4eb6dd0..7a41021 100644 (file)
@@ -922,11 +922,11 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
             return;
         }
 
-        Collection<String> visitedAddresses;
+        final Collection<String> visitedAddresses;
         if(message instanceof RemoteFindPrimary) {
             visitedAddresses = ((RemoteFindPrimary)message).getVisitedAddresses();
         } else {
-            visitedAddresses = new ArrayList<>();
+            visitedAddresses = new ArrayList<>(1);
         }
 
         visitedAddresses.add(peerAddressResolver.getShardManagerActorPathBuilder(cluster.getSelfAddress()).toString());