Class NamespaceIsolationPolicyImpl
java.lang.Object
org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicyImpl
- All Implemented Interfaces:
NamespaceIsolationPolicy
Implementation of the namespace isolation policy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfindPrimaryBrokers(List<URL> availableBrokers, NamespaceName namespace) Get the list of primary brokers for the namespace according to the policy.findSecondaryBrokers(List<URL> availableBrokers, NamespaceName namespace) Get the list of secondary brokers for the namespace according to the policy.getAvailablePrimaryBrokers(SortedSet<BrokerStatus> primaryCandidates) According to the namespace isolation policy, find the allowed available primary brokers.Get the list of regex for the set of primary brokers.Get the list of regex for the set of secondary brokers.Get the unload scope for the policy set call.inthashCode()booleanisPrimaryBroker(String broker) Check to see whether the specific host is a primary broker.booleanisPrimaryBrokerAvailable(BrokerStatus brkStatus) booleanisSecondaryBroker(String broker) Check to see whether the specific host is a secondary broker.booleanshouldFailover(int totalPrimaryResourceUnits) Check to see whether the primary brokers can still handle a new namespace or has to failover.booleanshouldFailover(SortedSet<BrokerStatus> brokerStatus) Check to see whether the primary brokers can still handle a new namespace or has to failover.booleanshouldFallback(SortedSet<BrokerStatus> primaryBrokers) Check to see whether the namespace ownership should fallback to the primary brokers.toString()
-
Constructor Details
-
NamespaceIsolationPolicyImpl
-
-
Method Details
-
getPrimaryBrokers
Description copied from interface:NamespaceIsolationPolicyGet the list of regex for the set of primary brokers.- Specified by:
getPrimaryBrokersin interfaceNamespaceIsolationPolicy- Returns:
-
getSecondaryBrokers
Description copied from interface:NamespaceIsolationPolicyGet the list of regex for the set of secondary brokers.- Specified by:
getSecondaryBrokersin interfaceNamespaceIsolationPolicy- Returns:
-
getUnloadScope
Description copied from interface:NamespaceIsolationPolicyGet the unload scope for the policy set call.- Specified by:
getUnloadScopein interfaceNamespaceIsolationPolicy
-
findPrimaryBrokers
Description copied from interface:NamespaceIsolationPolicyGet the list of primary brokers for the namespace according to the policy.- Specified by:
findPrimaryBrokersin interfaceNamespaceIsolationPolicy- Parameters:
availableBrokers- brokers identified by service URL.namespace- the namespace- Returns:
- a list brokers by service URL.
-
findSecondaryBrokers
Description copied from interface:NamespaceIsolationPolicyGet the list of secondary brokers for the namespace according to the policy.- Specified by:
findSecondaryBrokersin interfaceNamespaceIsolationPolicy- Parameters:
availableBrokers- brokers identified by service URL.namespace- the namespace- Returns:
- a list brokers by service URL.
-
shouldFallback
Description copied from interface:NamespaceIsolationPolicyCheck to see whether the namespace ownership should fallback to the primary brokers.- Specified by:
shouldFallbackin interfaceNamespaceIsolationPolicy- Returns:
-
isPrimaryBroker
Description copied from interface:NamespaceIsolationPolicyCheck to see whether the specific host is a primary broker.- Specified by:
isPrimaryBrokerin interfaceNamespaceIsolationPolicy- Returns:
-
isSecondaryBroker
Description copied from interface:NamespaceIsolationPolicyCheck to see whether the specific host is a secondary broker.- Specified by:
isSecondaryBrokerin interfaceNamespaceIsolationPolicy- Returns:
-
hashCode
public int hashCode() -
equals
-
getAvailablePrimaryBrokers
public SortedSet<BrokerStatus> getAvailablePrimaryBrokers(SortedSet<BrokerStatus> primaryCandidates) Description copied from interface:NamespaceIsolationPolicyAccording to the namespace isolation policy, find the allowed available primary brokers.- Specified by:
getAvailablePrimaryBrokersin interfaceNamespaceIsolationPolicy- Returns:
-
shouldFailover
Description copied from interface:NamespaceIsolationPolicyCheck to see whether the primary brokers can still handle a new namespace or has to failover.- Specified by:
shouldFailoverin interfaceNamespaceIsolationPolicy- Returns:
-
shouldFailover
public boolean shouldFailover(int totalPrimaryResourceUnits) Description copied from interface:NamespaceIsolationPolicyCheck to see whether the primary brokers can still handle a new namespace or has to failover.- Specified by:
shouldFailoverin interfaceNamespaceIsolationPolicy- Returns:
-
isPrimaryBrokerAvailable
- Specified by:
isPrimaryBrokerAvailablein interfaceNamespaceIsolationPolicy
-
toString
-