Package org.apache.ignite.events
Class EventAdapter
- java.lang.Object
-
- org.apache.ignite.events.EventAdapter
-
- All Implemented Interfaces:
Serializable
,Comparable<Event>
,Event
- Direct Known Subclasses:
BaselineChangedEvent
,BaselineConfigurationChangedEvent
,CacheConsistencyViolationEvent
,CacheEvent
,CacheObjectTransformedEvent
,CacheQueryExecutedEvent
,CacheQueryReadEvent
,CacheRebalancingEvent
,CheckpointEvent
,ClusterActivationEvent
,ClusterStateChangeEvent
,ClusterStateChangeStartedEvent
,ClusterTagUpdatedEvent
,DeploymentEvent
,DiscoveryEvent
,JobEvent
,NodeValidationFailedEvent
,PageReplacementStartedEvent
,SnapshotEvent
,SqlQueryExecutionEvent
,TaskEvent
,TransactionStateChangedEvent
,WalSegmentArchivedEvent
public class EventAdapter extends Object implements Event
Base adapter for the events. All events (including user-defined ones) should extend this adapter as it provides necessary plumbing implementation details.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EventAdapter()
No-arg constructor.EventAdapter(ClusterNode node, String msg, int type)
Creates event based with given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Event o)
boolean
equals(Object o)
int
hashCode()
IgniteUuid
id()
Gets globally unique ID of this event.long
localOrder()
Gets locally unique ID that is atomically incremented for each event.@Nullable String
message()
Gets optional message for this event.void
message(@Nullable String msg)
Sets optional event message.String
name()
Gets event type name.ClusterNode
node()
Node where event occurred and was recordedvoid
node(ClusterNode node)
Sets node where even is occurred (i.e. node local to the event).String
shortDisplay()
Gets a shortened version oftoString()
result.long
timestamp()
Gets event timestamp.String
toString()
int
type()
Gets type of this event.void
type(int type)
Sets event type.
-
-
-
Constructor Detail
-
EventAdapter
public EventAdapter()
No-arg constructor.
-
EventAdapter
public EventAdapter(ClusterNode node, String msg, int type)
Creates event based with given parameters.- Parameters:
node
- Event initiator node.msg
- Optional message.type
- Event type.
-
-
Method Detail
-
compareTo
public int compareTo(Event o)
- Specified by:
compareTo
in interfaceComparable<Event>
-
id
public IgniteUuid id()
Gets globally unique ID of this event.- Specified by:
id
in interfaceEvent
- Returns:
- Globally unique ID of this event.
- See Also:
Event.localOrder()
-
localOrder
public long localOrder()
Gets locally unique ID that is atomically incremented for each event. Unlike globalEvent.id()
this local ID can be used for ordering events on this node.Note that for performance considerations Ignite doesn't order events globally.
- Specified by:
localOrder
in interfaceEvent
- Returns:
- Locally unique ID that is atomically incremented for each new event.
- See Also:
Event.id()
-
node
public void node(ClusterNode node)
Sets node where even is occurred (i.e. node local to the event).- Parameters:
node
- Node.
-
message
public void message(@Nullable @Nullable String msg)
Sets optional event message.- Parameters:
msg
- Optional event message.
-
type
public void type(int type)
Sets event type.- Parameters:
type
- Event type.
-
node
public ClusterNode node()
Node where event occurred and was recorded
-
message
@Nullable public @Nullable String message()
Gets optional message for this event.
-
type
public int type()
Gets type of this event. All system event types are defined inEventType
.NOTE: all types in range from 1 to 1000 are reserved for internal Ignite events and should not be used by user-defined events.
-
timestamp
public long timestamp()
Gets event timestamp. Timestamp is local to the node on which this event was produced. Note that more than one event can be generated with the same timestamp. For ordering purposes useEvent.localOrder()
instead.
-
name
public String name()
Gets event type name.
-
shortDisplay
public String shortDisplay()
Gets a shortened version oftoString()
result. Suitable for humans to read.- Specified by:
shortDisplay
in interfaceEvent
- Returns:
- Shortened version of
toString()
result.
-
-