Package io.hekate.cluster.event
Class ClusterEventBase
- java.lang.Object
-
- io.hekate.cluster.event.ClusterEventBase
-
- All Implemented Interfaces:
ClusterEvent
,HekateSupport
- Direct Known Subclasses:
ClusterChangeEvent
,ClusterJoinEvent
,ClusterLeaveEvent
public abstract class ClusterEventBase extends Object implements ClusterEvent
Abstract base class forClusterEvent
implementations.- See Also:
ClusterEventListener
,ClusterService
-
-
Constructor Summary
Constructors Constructor Description ClusterEventBase(ClusterTopology topology, HekateSupport hekate)
Constructs a new instance with the specified topology snapshot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClusterChangeEvent
asChange()
Casts this instance to theClusterChangeEvent
type or returnsnull
if this instance can't be cast to that type.ClusterJoinEvent
asJoin()
Casts this instance to theClusterJoinEvent
type or returnsnull
if this instance can't be cast to that type.ClusterLeaveEvent
asLeave()
Casts this instance to theClusterLeaveEvent
type or returnsnull
if this instance can't be cast to that type.void
attach(CompletableFuture<?> future)
Attaches an arbitrary asynchronous task to this event.CompletableFuture<?>
future()
Returns a future object that represents all theattached
futures of this event.Hekate
hekate()
Returns theHekate
instance.ClusterTopology
topology()
Returns the cluster topology snapshot of this event.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.hekate.cluster.event.ClusterEvent
type
-
-
-
-
Constructor Detail
-
ClusterEventBase
public ClusterEventBase(ClusterTopology topology, HekateSupport hekate)
Constructs a new instance with the specified topology snapshot.- Parameters:
topology
- Topology.hekate
- Delegate forhekate()
.
-
-
Method Detail
-
hekate
public Hekate hekate()
Description copied from interface:HekateSupport
Returns theHekate
instance.- Specified by:
hekate
in interfaceHekateSupport
- Returns:
Hekate
instance.
-
topology
public ClusterTopology topology()
Description copied from interface:ClusterEvent
Returns the cluster topology snapshot of this event.- Specified by:
topology
in interfaceClusterEvent
- Returns:
- Cluster topology.
-
attach
public void attach(CompletableFuture<?> future)
Description copied from interface:ClusterEvent
Attaches an arbitrary asynchronous task to this event.The specified future object represents an asynchronous task that should be logically attached to this event in such a way that this event should not be considered completed until the task future is completed.
- Specified by:
attach
in interfaceClusterEvent
- Parameters:
future
- Synchronization future.- See Also:
ClusterEvent.future()
-
future
public CompletableFuture<?> future()
Description copied from interface:ClusterEvent
Returns a future object that represents all theattached
futures of this event.- Specified by:
future
in interfaceClusterEvent
- Returns:
- Future object that represents all the
attached
futures of this event. - See Also:
ClusterEvent.attach(CompletableFuture)
-
asJoin
public ClusterJoinEvent asJoin()
Description copied from interface:ClusterEvent
Casts this instance to theClusterJoinEvent
type or returnsnull
if this instance can't be cast to that type.- Specified by:
asJoin
in interfaceClusterEvent
- Returns:
- This instance as to
ClusterJoinEvent
ornull
if this instance can't be cast to that type.
-
asLeave
public ClusterLeaveEvent asLeave()
Description copied from interface:ClusterEvent
Casts this instance to theClusterLeaveEvent
type or returnsnull
if this instance can't be cast to that type.- Specified by:
asLeave
in interfaceClusterEvent
- Returns:
- This instance as to
ClusterLeaveEvent
ornull
if this instance can't be cast to that type.
-
asChange
public ClusterChangeEvent asChange()
Description copied from interface:ClusterEvent
Casts this instance to theClusterChangeEvent
type or returnsnull
if this instance can't be cast to that type.- Specified by:
asChange
in interfaceClusterEvent
- Returns:
- This instance as to
ClusterChangeEvent
ornull
if this instance can't be cast to that type.
-
-