Skip to content

Commit

Permalink
constructor change for CapacityNode
Browse files Browse the repository at this point in the history
  • Loading branch information
tengfmu committed Oct 23, 2024
1 parent c5e0be7 commit bb5b883
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ public class CapacityNode implements Comparable<CapacityNode> {
* @param capacity The capacity of this node
*/
public CapacityNode(String instanceName, int capacity) {
this._instanceName = instanceName;
this._logicaId = null;
this._faultZone = null;
this._partitionMap = new HashMap<>();
this(instanceName, null, null, null);
this._capacity = capacity;
this._currentlyAssigned = 0;
}

/**
* Constructor used for non-topology-aware use case
* Constructor used for topology-aware use case
* @param instanceName The instance name of this node
* @param clusterConfig The cluster config for current helix cluster
* @param clusterTopologyConfig The cluster topology config for current helix cluster
Expand All @@ -68,9 +64,11 @@ public CapacityNode(String instanceName, ClusterConfig clusterConfig,
this._instanceName = instanceName;
this._logicaId = clusterTopologyConfig != null ? instanceConfig.getLogicalId(
clusterTopologyConfig.getEndNodeType()) : instanceName;
this._faultZone = computeFaultZone(clusterConfig, instanceConfig);
this._faultZone =
clusterConfig != null ? computeFaultZone(clusterConfig, instanceConfig) : null;
this._partitionMap = new HashMap<>();
this._capacity = clusterConfig.getGlobalMaxPartitionAllowedPerInstance();
this._capacity =
clusterConfig != null ? clusterConfig.getGlobalMaxPartitionAllowedPerInstance() : 0;
this._currentlyAssigned = 0;
}

Expand Down

0 comments on commit bb5b883

Please sign in to comment.