use of org.apache.pulsar.common.policies.data.BrokerAssignment in project incubator-pulsar by apache.
the class NamespaceIsolationPolicies method assignBroker.
public void assignBroker(NamespaceName nsname, BrokerStatus brkStatus, SortedSet<BrokerStatus> primaryCandidates, SortedSet<BrokerStatus> secondaryCandidates, SortedSet<BrokerStatus> sharedCandidates) {
NamespaceIsolationPolicy nsPolicy = this.getPolicyByNamespace(nsname);
BrokerAssignment brokerAssignment = this.getBrokerAssignment(nsPolicy, brkStatus.getBrokerAddress());
if (brokerAssignment == BrokerAssignment.primary) {
// Only add to candidates if allowed by policy
if (nsPolicy != null && nsPolicy.isPrimaryBrokerAvailable(brkStatus)) {
primaryCandidates.add(brkStatus);
}
} else if (brokerAssignment == BrokerAssignment.secondary) {
secondaryCandidates.add(brkStatus);
} else if (brokerAssignment == BrokerAssignment.shared) {
sharedCandidates.add(brkStatus);
}
}
Aggregations