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, 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 and 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 and 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 recorded
    `void` | `node(ClusterNode node)` Sets node where even is occurred (i.e. node local to the event).
    `String` | `shortDisplay()` Gets a shortened version of `toString()` result.
    `long` | `timestamp()` Gets event timestamp.
    `String` | `toString()`
    `int` | `type()` Gets type of this event.
    `void` | `type(int type)` Sets event type.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 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 interface `Comparable<Event>`

    - #### id

          public IgniteUuid id()

      Gets globally unique ID of this event.
      Specified by:
        `id` in interface `Event`
      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 global `Event.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 interface `Event`
      Returns:
        Locally unique ID that is atomically incremented for each new event.
      See Also:
        `Event.id()`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### 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
      Specified by:
        `node` in interface `Event`
      Returns:
        node where event occurred and was recorded.

    - #### message

          @Nullable
          public @Nullable String message()

      Gets optional message for this event.
      Specified by:
        `message` in interface `Event`
      Returns:
        Optional (can be `null`) message for this event.

    - #### type

          public int type()

      Gets type of this event. All system event types are defined in `EventType`.

      NOTE: all types in range from 1 to 1000 are reserved for internal Ignite events and should not be used by user-defined events.

      Specified by:
        `type` in interface `Event`
      Returns:
        Event's type.
      See Also:
        `EventType`

    - #### 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 use `Event.localOrder()` instead.
      Specified by:
        `timestamp` in interface `Event`
      Returns:
        Event timestamp.

    - #### name

          public String name()

      Gets event type name.
      Specified by:
        `name` in interface `Event`
      Returns:
        Event type name.

    - #### shortDisplay

          public String shortDisplay()

      Gets a shortened version of `toString()` result. Suitable for humans to read.
      Specified by:
        `shortDisplay` in interface `Event`
      Returns:
        Shortened version of `toString()` result.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022