Interface DistributionManager


  • public interface DistributionManager
    A DistributionManager coordinates the distribution of partitions for a partitioned service. The DistributionManager relies on a pluggable PartitionAssignmentStrategy to analyze the current state of the partition usage, and formulate a desired distribution plan. The DistributionManager is responsible for gathering and providing to the strategy the state necessary to make distribution decisions, as well as collecting and enacting the formulated distribution recommendations.

    The DistributionManager provides a consistent and stable view of Service-related state for the duration of the call to PartitionAssignmentStrategy.analyzeDistribution().

    Since:
    Coherence 3.7
    Author:
    rhl 2010.10.22
    • Method Detail

      • getService

        PartitionedService getService()
        Return the partitioned service for which this DistributionManager coordinates the distribution.
        Returns:
        the partitioned service
      • getMember

        Member getMember​(int nMemberId)
        Return the ownership-enabled service member with the specified mini-id, or null if the member does not exist.
        Parameters:
        nMemberId - the mini-id
        Returns:
        the ownership-enabled service member with the specified mini-id, or null
      • getOwnershipMembers

        Set<Member> getOwnershipMembers()
        Return the set of ownership-enabled members in the partitioned service.
        Returns:
        the set of ownership-enabled members
      • getOwnershipLeavingMembers

        Set<Member> getOwnershipLeavingMembers()
        Return the set of ownership-enabled members in the partitioned service that are in the process of leaving.
        Returns:
        the set of ownership-enabled members that are leaving
      • getOwnedPartitions

        PartitionSet getOwnedPartitions​(Member member,
                                        int iStore)
        Return the set of partitions for which the specified member owns the specified storage index (replica).
        Parameters:
        member - the member to determine the the ownership for
        iStore - the storage index (zero for primary)
        Returns:
        the set of partitions
        Throws:
        IllegalArgumentException - if the backup number is non-positive or greater than the backup count for this partitioned service
      • getPartitionOwnership

        Ownership getPartitionOwnership​(int nPartition)
        Return the Ownership information for the specified partition.
        Parameters:
        nPartition - the partition to return the ownership for
        Returns:
        Ownership information for the specified partition
        Throws:
        IllegalArgumentException - if the partition number is negative or greater than the partition count for this partitioned service
      • suggest

        void suggest​(PartitionSet parts,
                     Ownership ownership)
        Suggest a distribution change for the specified set of partitions, indicating either primary or backup transfer (or both). The desired transfer is specified as the ownership that would result from enacting the transfer.

        Note: this method does not in any way enforce or guarantee that the specified transfers are performed; it merely provides advice

        Parameters:
        parts - the set of partitions to perform distribution on
        ownership - the desired ownership
      • getIgnoredAdvice

        PartitionSet getIgnoredAdvice()
        Return a set of partitions from the previous suggestions that were ignored or rejected.
        Returns:
        partitions that were suggested for an ownership change, but those changes were rejected by the service
        Since:
        Coherence 12.2.1
      • scheduleNextAnalysis

        void scheduleNextAnalysis​(long cMillis)
        Schedule the next distribution analysis in the specified time interval.

        This method may influence, but does not guarantee the time of the next distribution analysis. This method may be called on any thread but has an effect only if this member is currently the distribution coordinator.

        Parameters:
        cMillis - the delay (in ms) before the next analysis (must be > 0)
        Since:
        Coherence 12.1.2
      • getSamplingPeriod

        long getSamplingPeriod()
        Return the sampling period at which partition statistics are collected.
        Returns:
        the sampling period in milliseconds
      • getPartitionStats

        PartitionStatistics[] getPartitionStats()
        Return an array of the most recently available partition statistics, indexed by partition-id.
        Returns:
        an array of the most recently available partition statistics