Class DiscoveryDataClusterState

  • All Implemented Interfaces:
    Serializable

    public class DiscoveryDataClusterState
    extends Object
    implements Serializable
    A pojo-object representing current cluster global state. The state includes cluster active flag and cluster baseline topology.

    This object also captures a transitional cluster state, when one or more fields are changing. In this case, a transitionReqId field is set to a non-null value and previousBaselineTopology captures previous cluster state. A joining node catching the cluster in an intermediate state will observe transitionReqId field to be non-null, however the previousBaselineTopology will not be sent to the joining node. TODO https://issues.apache.org/jira/browse/IGNITE-7640 This class must be immutable, transitionRes must be set by calling finish().

    See Also:
    Serialized Form
    • Method Detail

      • lastState

        public ClusterState lastState()
        Returns:
        Cluster state before transition if cluster in transition and current cluster state otherwise.
      • transitionResult

        @Nullable
        public @Nullable ClusterState transitionResult()
        Returns:
        Local flag for state transition result (global state is updated asynchronously by custom message).
      • setTransitionResult

        public void setTransitionResult​(UUID reqId,
                                        ClusterState state)
        Discovery cluster state is changed asynchronously by discovery message, this methods changes local status for public API calls.
        Parameters:
        reqId - Request ID.
        state - New cluster state.
      • transitionRequestId

        public UUID transitionRequestId()
        Returns:
        State change request ID.
      • transition

        public boolean transition()
        Returns:
        True if any cluster state change is in progress (e.g. active state change, baseline change).
      • previouslyActive

        public boolean previouslyActive()
        Returns:
        Previous "active" flag value during transition.
      • transitionTopologyVersion

        public AffinityTopologyVersion transitionTopologyVersion()
        Returns:
        State change exchange version.
      • active

        @Deprecated
        public boolean active()
        Deprecated.
        Use state() instead.
        Returns:
        Current cluster state (or new state in case when transition is in progress).
      • state

        public ClusterState state()
        Returns:
        Current cluster state (or new state in case when transition is in progress).
      • lastStateChangeTime

        public long lastStateChangeTime()
        Returns:
        Time of last cluster state change.
      • baselineTopology

        @Nullable
        public @Nullable BaselineTopology baselineTopology()
        Returns:
        Baseline topology.
      • previousBaselineTopology

        @Nullable
        public @Nullable BaselineTopology previousBaselineTopology()
        Returns:
        Previous Baseline topology.
      • baselineChanged

        public boolean baselineChanged()
        Returns:
        True If baseLine changed, False if not.
      • hasBaselineTopology

        public boolean hasBaselineTopology()
        Returns:
        True if baseline topology is set in the cluster. False otherwise.
      • transitionNodes

        public Set<UUID> transitionNodes()
        Returns:
        Nodes participating in state change exchange.
      • transitionError

        @Nullable
        public @Nullable Exception transitionError()
        Returns:
        Transition error.
      • transitionError

        public void transitionError​(Exception ex)
        Parameters:
        ex - Exception
      • localBaselineAutoAdjustment

        public boolean localBaselineAutoAdjustment()
        Returns:
        true if current state was created as a result of local baseline autoadjustment with zero timeout on in-memory cluster.
      • localBaselineAutoAdjustment

        public void localBaselineAutoAdjustment​(boolean adjusted)
        Set local baseline autoadjustment flag.
        Parameters:
        adjusted - Flag value.
        See Also:
        localBaselineAutoAdjustment()
      • finish

        public DiscoveryDataClusterState finish​(boolean success)
        Creates a non-transitional cluster state. This method effectively cleans all fields identifying the state as transitional and creates a new state with the state transition result.
        Parameters:
        success - Transition success status.
        Returns:
        Cluster state that finished transition.