Class AbstractControlledLocalTopologyManager

  • All Implemented Interfaces:
    LocalTopologyManager

    public abstract class AbstractControlledLocalTopologyManager
    extends java.lang.Object
    implements LocalTopologyManager
    Class to be extended to allow some control over the local topology manager when testing Infinispan.

    Note: create before/after method lazily when need.

    Since:
    6.0
    Author:
    Pedro Ruivo
    • Constructor Detail

      • AbstractControlledLocalTopologyManager

        protected AbstractControlledLocalTopologyManager​(LocalTopologyManager delegate)
    • Method Detail

      • leave

        public final void leave​(java.lang.String cacheName,
                                long timeout)
        Description copied from interface: LocalTopologyManager
        Forwards the leave request to the coordinator.
        Specified by:
        leave in interface LocalTopologyManager
      • confirmRebalancePhase

        public final void confirmRebalancePhase​(java.lang.String cacheName,
                                                int topologyId,
                                                int rebalanceId,
                                                java.lang.Throwable throwable)
        Description copied from interface: LocalTopologyManager
        Confirm that the local cache cacheName has finished receiving the new data for topology topologyId.

        The coordinator can change during the state transfer, so we make the rebalance RPC async and we send the response as a different command.

        Specified by:
        confirmRebalancePhase in interface LocalTopologyManager
        Parameters:
        cacheName - the name of the cache
        topologyId - the current topology id of the node at the time the rebalance is completed. This must be >= than the one when rebalance starts.
        throwable - null unless local rebalance ended because of an error.
      • handleTopologyUpdate

        public final void handleTopologyUpdate​(java.lang.String cacheName,
                                               CacheTopology cacheTopology,
                                               AvailabilityMode availabilityMode,
                                               int viewId,
                                               Address sender)
                                        throws java.lang.InterruptedException
        Description copied from interface: LocalTopologyManager
        Updates the current and/or pending consistent hash, without transferring any state.
        Specified by:
        handleTopologyUpdate in interface LocalTopologyManager
        Throws:
        java.lang.InterruptedException
      • isRebalancingEnabled

        public boolean isRebalancingEnabled()
                                     throws java.lang.Exception
        Description copied from interface: LocalTopologyManager
        Checks whether rebalancing is enabled for the entire cluster.
        Specified by:
        isRebalancingEnabled in interface LocalTopologyManager
        Throws:
        java.lang.Exception
      • setRebalancingEnabled

        public void setRebalancingEnabled​(boolean enabled)
                                   throws java.lang.Exception
        Description copied from interface: LocalTopologyManager
        Enable or disable rebalancing in the entire cluster.
        Specified by:
        setRebalancingEnabled in interface LocalTopologyManager
        Throws:
        java.lang.Exception
      • isCacheRebalancingEnabled

        public boolean isCacheRebalancingEnabled​(java.lang.String cacheName)
                                          throws java.lang.Exception
        Description copied from interface: LocalTopologyManager
        Checks whether rebalancing is enabled for the specified cache.
        Specified by:
        isCacheRebalancingEnabled in interface LocalTopologyManager
        Throws:
        java.lang.Exception
      • setCacheRebalancingEnabled

        public void setCacheRebalancingEnabled​(java.lang.String cacheName,
                                               boolean enabled)
                                        throws java.lang.Exception
        Description copied from interface: LocalTopologyManager
        Enable or disable rebalancing for the specified cache.
        Specified by:
        setCacheRebalancingEnabled in interface LocalTopologyManager
        Throws:
        java.lang.Exception
      • startDelegate

        public final void startDelegate()
      • stopDelegate

        public final void stopDelegate()
      • isTotalOrderCache

        public boolean isTotalOrderCache​(java.lang.String cacheName)
        Description copied from interface: LocalTopologyManager
        Checks if the cache defined by cacheName is using total order.

        If this component is not running or the cacheName is not defined, it returns false.

        Specified by:
        isTotalOrderCache in interface LocalTopologyManager
        Returns:
        true if the cache is using the total order protocol, false otherwise.
      • beforeHandleTopologyUpdate

        protected void beforeHandleTopologyUpdate​(java.lang.String cacheName,
                                                  CacheTopology cacheTopology,
                                                  int viewId)
      • beforeHandleRebalance

        protected void beforeHandleRebalance​(java.lang.String cacheName,
                                             CacheTopology cacheTopology,
                                             int viewId)
      • beforeConfirmRebalancePhase

        protected void beforeConfirmRebalancePhase​(java.lang.String cacheName,
                                                   int topologyId,
                                                   java.lang.Throwable throwable)
      • cacheShutdown

        public void cacheShutdown​(java.lang.String name)
                           throws java.lang.Exception
        Description copied from interface: LocalTopologyManager
        Initiates a cluster-wide cache shutdown for the specified cache
        Specified by:
        cacheShutdown in interface LocalTopologyManager
        Throws:
        java.lang.Exception