Class ClusterCacheStatus

  • All Implemented Interfaces:

    public class ClusterCacheStatus
    extends java.lang.Object
    implements org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
    Keeps track of a cache's status: members, current/pending consistent hashes, and rebalance status
    Dan Berindei
    • Method Detail

      • getJoinInfo

        public CacheJoinInfo getJoinInfo()
        Specified by:
        getJoinInfo in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • getExpectedMembers

        public java.util.List<Address> getExpectedMembers()
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        The members of the cache. Includes nodes which have tried to join the cache but are not yet part of the current CacheTopology. Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the current topology.
        Specified by:
        getExpectedMembers in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • queueRebalance

        public void queueRebalance​(java.util.List<Address> newMembers)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Queue (or start) a rebalance. Use the configured ConsistentHashFactory to create a new balanced consistent hash with the given members. If there is no rebalance in progress, start a rebalance right away. If there is a rebalance in progress, queue another rebalance. If there is a rebalance in the queue as well, it will be replaced with the new one. If newConsistentHash == null, remove any queued rebalance.
        Specified by:
        queueRebalance in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • isTotalOrder

        public boolean isTotalOrder()
      • isDistributed

        public boolean isDistributed()
      • getCapacityFactors

        public java.util.Map<Address,​java.lang.Float> getCapacityFactors()
        Specified by:
        getCapacityFactors in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • getCurrentTopology

        public CacheTopology getCurrentTopology()
        Specified by:
        getCurrentTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        The current cache topology.
      • getStableTopology

        public CacheTopology getStableTopology()
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Whenever a new cache topology without a pendingCH and with at least numOwners owners for each segment is installed, and the cache is AvailabilityMode.AVAILABLE, the current cache topology is marked as the stable topology. The same happens when a rebalance is scheduled to start, but it doesn't do anything because the current topology is already balanced.
        Specified by:
        getStableTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        The last stable cache topology. May be null.
      • getAvailabilityMode

        public AvailabilityMode getAvailabilityMode()
        Specified by:
        getAvailabilityMode in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        The current availability mode.
      • updateAvailabilityMode

        public void updateAvailabilityMode​(java.util.List<Address> actualMembers,
                                           AvailabilityMode newAvailabilityMode,
                                           boolean cancelRebalance)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Enter a new availability mode.
        Specified by:
        updateAvailabilityMode in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • updateTopologiesAfterMerge

        public void updateTopologiesAfterMerge​(CacheTopology currentTopology,
                                               CacheTopology stableTopology,
                                               AvailabilityMode availabilityMode)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Updates both the stable and the current topologies. Does not install the current topology on the cache members.
        Specified by:
        updateTopologiesAfterMerge in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • isRebalanceInProgress

        public boolean isRebalanceInProgress()
      • confirmRebalancePhase

        public void confirmRebalancePhase​(Address member,
                                          int receivedTopologyId)
                                   throws java.lang.Exception
      • doHandleClusterView

        public void doHandleClusterView​(int viewId)
      • updateCurrentTopology

        public void updateCurrentTopology​(java.util.List<Address> newMembers)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Use the configured ConsistentHashFactory to create a new CH with the given members, but do not start a rebalance. Members missing from the current topology are ignored.
        Specified by:
        updateCurrentTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • getCacheName

        public java.lang.String getCacheName()
        Specified by:
        getCacheName in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • createInitialCacheTopology

        protected CacheTopology createInitialCacheTopology()
      • doLeave

        public boolean doLeave​(Address leaver)
                        throws java.lang.Exception
      • startQueuedRebalance

        public void startQueuedRebalance()
      • isRebalanceEnabled

        public boolean isRebalanceEnabled()
      • setRebalanceEnabled

        public void setRebalanceEnabled​(boolean enabled)
      • forceRebalance

        public void forceRebalance()
      • forceAvailabilityMode

        public void forceAvailabilityMode​(AvailabilityMode newAvailabilityMode)
      • shutdownCache

        public void shutdownCache()
                           throws java.lang.Exception
      • setInitialTopologyId

        public void setInitialTopologyId​(int initialTopologyId)
      • resolveConflictsOnMerge

        public boolean resolveConflictsOnMerge()
        Specified by:
        resolveConflictsOnMerge in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        true if PartitionHandlingConfiguration.mergePolicy() != null
      • calculateConflictHash

        public ConsistentHash calculateConflictHash​(ConsistentHash preferredHash,
                                                    java.util.Set<ConsistentHash> distinctHashes,
                                                    java.util.List<Address> actualMembers)
        Specified by:
        calculateConflictHash in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        preferredHash - the base consistent hash
        distinctHashes - a set of all hashes to be utilised as part of the conflict resolution hash
        actualMembers - a set of all valid addresses
        the hash to be utilised as a pending CH during Phase.CONFLICT_RESOLUTION
      • queueConflictResolution

        public void queueConflictResolution​(CacheTopology conflictTopology,
                                            java.util.Set<Address> preferredNodes)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Initiates conflict resolution using the conflictTopology, which should have already been broadcast via {@link this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)}
        Specified by:
        queueConflictResolution in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        conflictTopology - the topology to use during conflict resolution
        preferredNodes - the addresses that belong to the preferred partition as determined by the AvailabilityStrategy
      • restartConflictResolution

        public boolean restartConflictResolution​(java.util.List<Address> members)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        If CR is in progress, then this method cancels the current CR and starts a new CR phase with an updated topology based upon newMembers and the previously queued CR topology
        Specified by:
        restartConflictResolution in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        members - the latest members of the current view
        true if conflict resolution was restarted due to the newMembers