Speed up ClusterWrapperImpl 25/14425/1
authorRobert Varga <rovarga@cisco.com>
Fri, 23 Jan 2015 10:18:06 +0000 (11:18 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 23 Jan 2015 11:13:51 +0000 (12:13 +0100)
Instead of forcing a Set.toArray(), just pick the first entry in
iteration order.

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

index 4edd60a33af436fff36e77627657d2cd7844a6c3..d7bfae1b42b88a36be7a9e29124af53231111757 100644 (file)
@@ -32,9 +32,8 @@ public class ClusterWrapperImpl implements ClusterWrapper {
                 "member-3 here would be the name of the member"
         );
 
-        currentMemberName = (String) cluster.getSelfRoles().toArray()[0];
+        currentMemberName = cluster.getSelfRoles().iterator().next();
         selfAddress = cluster.selfAddress();
-
     }
 
     public void subscribeToMemberEvents(ActorRef actorRef){