File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/common Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -194,15 +194,23 @@ public synchronized ImmutableList<IClusterDetail> getClusterDetails() {
194194 // TODO: so far we have not a good way to judge whether it is token expired as
195195 // we have changed the way to list HDInsight clusters
196196 isListClusterSuccess = clusterDetailList .size () != 0 ;
197+ ArrayList <IClusterDetail > additionalCluster = new ArrayList <>(hdinsightAdditionalClusterDetails );
197198
198199 List <IClusterDetail > mergedClusters = clusterDetailList .stream ()
200+ .filter (clusterDetail -> clusterDetail .getSubscription ().isSelected ())
199201 // replace the duplicated cluster with linked one
200- .map (cluster -> hdinsightAdditionalClusterDetails .stream ()
201- .filter (linkedCluster -> linkedCluster .getName ().equals (cluster .getName ()))
202- .findFirst ()
203- .orElse (cluster ))
202+ .map (cluster -> {
203+ Optional <IClusterDetail > linkedAndInSubscriptionCluster = additionalCluster .stream ()
204+ .filter (linkedCluster -> linkedCluster .getName ().equals (cluster .getName ()))
205+ .findFirst ();
206+
207+ linkedAndInSubscriptionCluster .ifPresent (additionalCluster ::remove );
208+
209+ return linkedAndInSubscriptionCluster .orElse (cluster );
210+ })
204211 .collect (Collectors .toList ());
205212
213+ mergedClusters .addAll (additionalCluster );
206214 mergedClusters .addAll (emulatorClusterDetails );
207215
208216 ClusterMetaDataService .getInstance ().addCachedClusters (mergedClusters );
You can’t perform that action at this time.
0 commit comments