Class NamespaceIsolationPolicyImpl
java.lang.Object
org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicyImpl
- All Implemented Interfaces:
NamespaceIsolationPolicy
Implementation of the namespace isolation policy.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
findPrimaryBrokers
(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.int
hashCode()
boolean
isPrimaryBroker
(String broker) Check to see whether the specific host is a primary broker.boolean
isPrimaryBrokerAvailable
(BrokerStatus brkStatus) boolean
isSecondaryBroker
(String broker) Check to see whether the specific host is a secondary broker.boolean
shouldFailover
(int totalPrimaryResourceUnits) Check to see whether the primary brokers can still handle a new namespace or has to failover.boolean
shouldFailover
(SortedSet<BrokerStatus> brokerStatus) Check to see whether the primary brokers can still handle a new namespace or has to failover.boolean
shouldFallback
(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:NamespaceIsolationPolicy
Get the list of regex for the set of primary brokers.- Specified by:
getPrimaryBrokers
in interfaceNamespaceIsolationPolicy
- Returns:
-
getSecondaryBrokers
Description copied from interface:NamespaceIsolationPolicy
Get the list of regex for the set of secondary brokers.- Specified by:
getSecondaryBrokers
in interfaceNamespaceIsolationPolicy
- Returns:
-
findPrimaryBrokers
Description copied from interface:NamespaceIsolationPolicy
Get the list of primary brokers for the namespace according to the policy.- Specified by:
findPrimaryBrokers
in interfaceNamespaceIsolationPolicy
- Parameters:
availableBrokers
- brokers identified by service URL.namespace
- the namespace- Returns:
- a list brokers by service URL.
-
findSecondaryBrokers
Description copied from interface:NamespaceIsolationPolicy
Get the list of secondary brokers for the namespace according to the policy.- Specified by:
findSecondaryBrokers
in interfaceNamespaceIsolationPolicy
- Parameters:
availableBrokers
- brokers identified by service URL.namespace
- the namespace- Returns:
- a list brokers by service URL.
-
shouldFallback
Description copied from interface:NamespaceIsolationPolicy
Check to see whether the namespace ownership should fallback to the primary brokers.- Specified by:
shouldFallback
in interfaceNamespaceIsolationPolicy
- Returns:
-
isPrimaryBroker
Description copied from interface:NamespaceIsolationPolicy
Check to see whether the specific host is a primary broker.- Specified by:
isPrimaryBroker
in interfaceNamespaceIsolationPolicy
- Returns:
-
isSecondaryBroker
Description copied from interface:NamespaceIsolationPolicy
Check to see whether the specific host is a secondary broker.- Specified by:
isSecondaryBroker
in interfaceNamespaceIsolationPolicy
- Returns:
-
hashCode
public int hashCode() -
equals
-
getAvailablePrimaryBrokers
public SortedSet<BrokerStatus> getAvailablePrimaryBrokers(SortedSet<BrokerStatus> primaryCandidates) Description copied from interface:NamespaceIsolationPolicy
According to the namespace isolation policy, find the allowed available primary brokers.- Specified by:
getAvailablePrimaryBrokers
in interfaceNamespaceIsolationPolicy
- Returns:
-
shouldFailover
Description copied from interface:NamespaceIsolationPolicy
Check to see whether the primary brokers can still handle a new namespace or has to failover.- Specified by:
shouldFailover
in interfaceNamespaceIsolationPolicy
- Returns:
-
shouldFailover
public boolean shouldFailover(int totalPrimaryResourceUnits) Description copied from interface:NamespaceIsolationPolicy
Check to see whether the primary brokers can still handle a new namespace or has to failover.- Specified by:
shouldFailover
in interfaceNamespaceIsolationPolicy
- Returns:
-
isPrimaryBrokerAvailable
- Specified by:
isPrimaryBrokerAvailable
in interfaceNamespaceIsolationPolicy
-
toString
-