Class NamespaceIsolationPolicyImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      NamespaceIsolationPolicyImpl​(org.apache.pulsar.common.policies.data.NamespaceIsolationData policyData)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.util.List<java.net.URL> findPrimaryBrokers​(java.util.List<java.net.URL> availableBrokers, NamespaceName namespace)
      Get the list of primary brokers for the namespace according to the policy.
      java.util.List<java.net.URL> findSecondaryBrokers​(java.util.List<java.net.URL> availableBrokers, NamespaceName namespace)
      Get the list of secondary brokers for the namespace according to the policy.
      java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> getAvailablePrimaryBrokers​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates)
      According to the namespace isolation policy, find the allowed available primary brokers.
      java.util.List<java.lang.String> getPrimaryBrokers()
      Get the list of regex for the set of primary brokers.
      java.util.List<java.lang.String> getSecondaryBrokers()
      Get the list of regex for the set of secondary brokers.
      int hashCode()  
      boolean isPrimaryBroker​(java.lang.String broker)
      Check to see whether the specific host is a primary broker.
      boolean isPrimaryBrokerAvailable​(org.apache.pulsar.common.policies.data.BrokerStatus brkStatus)  
      boolean isSecondaryBroker​(java.lang.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​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> brokerStatus)
      Check to see whether the primary brokers can still handle a new namespace or has to failover.
      boolean shouldFallback​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryBrokers)
      Check to see whether the namespace ownership should fallback to the primary brokers.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • NamespaceIsolationPolicyImpl

        public NamespaceIsolationPolicyImpl​(org.apache.pulsar.common.policies.data.NamespaceIsolationData policyData)
    • Method Detail

      • findPrimaryBrokers

        public java.util.List<java.net.URL> findPrimaryBrokers​(java.util.List<java.net.URL> availableBrokers,
                                                               NamespaceName namespace)
        Description copied from interface: NamespaceIsolationPolicy
        Get the list of primary brokers for the namespace according to the policy.
        Specified by:
        findPrimaryBrokers in interface NamespaceIsolationPolicy
        Parameters:
        availableBrokers - brokers identified by service URL.
        namespace - the namespace
        Returns:
        a list brokers by service URL.
      • findSecondaryBrokers

        public java.util.List<java.net.URL> findSecondaryBrokers​(java.util.List<java.net.URL> availableBrokers,
                                                                 NamespaceName namespace)
        Description copied from interface: NamespaceIsolationPolicy
        Get the list of secondary brokers for the namespace according to the policy.
        Specified by:
        findSecondaryBrokers in interface NamespaceIsolationPolicy
        Parameters:
        availableBrokers - brokers identified by service URL.
        namespace - the namespace
        Returns:
        a list brokers by service URL.
      • shouldFallback

        public boolean shouldFallback​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryBrokers)
        Description copied from interface: NamespaceIsolationPolicy
        Check to see whether the namespace ownership should fallback to the primary brokers.
        Specified by:
        shouldFallback in interface NamespaceIsolationPolicy
        Returns:
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getAvailablePrimaryBrokers

        public java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> getAvailablePrimaryBrokers​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates)
        Description copied from interface: NamespaceIsolationPolicy
        According to the namespace isolation policy, find the allowed available primary brokers.
        Specified by:
        getAvailablePrimaryBrokers in interface NamespaceIsolationPolicy
        Returns:
      • shouldFailover

        public boolean shouldFailover​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> brokerStatus)
        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 interface NamespaceIsolationPolicy
        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 interface NamespaceIsolationPolicy
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object