Package io.hekate.cluster.event
Class ClusterChangeEvent
- java.lang.Object
-
- io.hekate.cluster.event.ClusterEventBase
-
- io.hekate.cluster.event.ClusterChangeEvent
-
- All Implemented Interfaces:
ClusterEvent
,HekateSupport
public class ClusterChangeEvent extends ClusterEventBase
Cluster topology change event.This event gets fired by the
ClusterService
every time whenever cluster topology changes are detected. This event includes information about all new nodes that joined the cluster and all old nodes that left the cluster.For more details about cluster events handling please see the documentation of
ClusterEventListener
interface.- See Also:
ClusterEventListener
-
-
Constructor Summary
Constructors Constructor Description ClusterChangeEvent(ClusterTopology oldTopology, ClusterTopology newTopology, Set<ClusterNode> failed, HekateSupport hekate)
Constructs a new instance by comparing old and new cluster topologies.ClusterChangeEvent(ClusterTopology topology, List<ClusterNode> added, List<ClusterNode> removed, List<ClusterNode> failed, HekateSupport hekate)
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ClusterNode>
added()
Returns the list of new nodes that joined the cluster.ClusterChangeEvent
asChange()
Returns this instance.List<ClusterNode>
failed()
Returns the list of failed nodes.List<ClusterNode>
removed()
Returns the list of nodes that left the cluster.String
toString()
ClusterEventType
type()
ReturnsClusterEventType.CHANGE
.
-
-
-
Constructor Detail
-
ClusterChangeEvent
public ClusterChangeEvent(ClusterTopology topology, List<ClusterNode> added, List<ClusterNode> removed, List<ClusterNode> failed, HekateSupport hekate)
Constructs a new instance.- Parameters:
topology
- Topology.added
- List of newly joined nodes (seeadded()
).removed
- List of nodes that left the cluster (seeremoved()
).failed
- List of failed nodes (seefailed()
).hekate
- Delegate forClusterEventBase.hekate()
.
-
ClusterChangeEvent
public ClusterChangeEvent(ClusterTopology oldTopology, ClusterTopology newTopology, Set<ClusterNode> failed, HekateSupport hekate)
Constructs a new instance by comparing old and new cluster topologies.- Parameters:
oldTopology
- Old topology.newTopology
- New topology.failed
- Failed nodes (seefailed()
).hekate
- Delegate forClusterEventBase.hekate()
.
-
-
Method Detail
-
added
public List<ClusterNode> added()
Returns the list of new nodes that joined the cluster.- Returns:
- List of new nodes that joined the cluster.
-
removed
public List<ClusterNode> removed()
Returns the list of nodes that left the cluster.This list contains nodes that left the cluster normally and those that were considered to be failed and forcefully removed.
For the list of nodes that were forcefully removed from the cluster by the failure detection logic please see the
failed()
method.- Returns:
- List of nodes that left the cluster.
-
failed
public List<ClusterNode> failed()
Returns the list of failed nodes.This list contains those nodes that were removed from the cluster by the failure detection logic (see
FailureDetector
).- Returns:
- List of failed nodes.
-
type
public ClusterEventType type()
ReturnsClusterEventType.CHANGE
.- Returns:
ClusterEventType.CHANGE
.
-
asChange
public ClusterChangeEvent asChange()
Returns this instance.- Specified by:
asChange
in interfaceClusterEvent
- Overrides:
asChange
in classClusterEventBase
- Returns:
- This instance.
-
-