diff --git a/helix-rest/src/main/java/org/apache/helix/rest/common/StoppableInstancesSelector.java b/helix-rest/src/main/java/org/apache/helix/rest/common/StoppableInstancesSelector.java index 63c3943457..b12b3d2f14 100644 --- a/helix-rest/src/main/java/org/apache/helix/rest/common/StoppableInstancesSelector.java +++ b/helix-rest/src/main/java/org/apache/helix/rest/common/StoppableInstancesSelector.java @@ -1,5 +1,24 @@ package org.apache.helix.rest.common; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -19,24 +38,6 @@ import org.apache.helix.rest.server.json.cluster.ClusterTopology; import org.apache.helix.rest.server.json.instance.StoppableCheck; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ public class StoppableInstancesSelector { // This type does not belong to real HealthCheck failed reason. Also, if we add this type // to HealthCheck enum, it could introduce more unnecessary check step since the InstanceServiceImpl @@ -116,10 +117,9 @@ public void getStoppableInstancesCrossZones() { * * If `isRandom` is true, the order of zones will be randomized regardless of any previous order. * - * @param isRandom Indicates whether to randomize the order of zones. + * @param random Indicates whether to randomize the order of zones. */ - public void calculateOrderOfZone(boolean isRandom) { - // If the orderedZones is not specified, we will order all zones by their instances count in descending order. + public void calculateOrderOfZone(boolean random) { if (_orderOfZone == null) { _orderOfZone = new ArrayList<>(getOrderedZoneToInstancesMap(_clusterTopology.toZoneMapping()).keySet()); @@ -129,7 +129,7 @@ public void calculateOrderOfZone(boolean isRandom) { return; } - if (isRandom) { + if (random) { Collections.shuffle(_orderOfZone); } }