org.apache.ignite.internal.managers.eventstorage

## Class GridEventStorageManager

- java.lang.Object
- - org.apache.ignite.internal.managers.GridManagerAdapter<EventStorageSpi>
  - - org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager

All Implemented Interfaces:
  GridComponent, GridManager

    public class GridEventStorageManager
    extends GridManagerAdapter<EventStorageSpi>

Grid event storage SPI manager.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`ctx, log`

### Constructor Summary

Constructors
Constructor and Description
`GridEventStorageManager(GridKernalContext ctx)`

### Method Summary

Methods
`void` `addLocalEventListener(GridLocalEventListener lsnr, int[] types)` Adds local event listener.
`void` `addLocalEventListener(GridLocalEventListener lsnr, int type, int... types)` Adds local event listener.
`void` `addLocalEventListener(IgnitePredicate<? extends Event> lsnr, int[] types)` Adds local user event listener.
`void` `disableEvents(int[] types)` Disables provided events.
`int[]` `enabledEvents()` Gets types of enabled user-recordable events.
`void` `enableEvents(int[] types)` Enables provided events.
`boolean` `isAllUserRecordable(int[] types)` Checks whether all provided events are user-recordable.
`boolean` `isRecordable(int type)` Checks whether this event type should be recorded.
`boolean` `isUserRecordable(int type)` Checks if the event type is user-recordable.
`<T extends Event> Collection<T>` `localEvents(IgnitePredicate<T> p)`
`void` `onKernalStop0(boolean cancel)`
`void` `printMemoryStats()` Prints memory statistics (sizes of internal structures, etc.).
`void` `record(Event evt)` Records event if it's recordable.
`<T extends Event> IgniteInternalFuture<List<T>>` `remoteEventsAsync(IgnitePredicate<T> p, Collection<? extends ClusterNode> nodes, long timeout)`
`boolean` `removeLocalEventListener(GridLocalEventListener lsnr, int... types)` Removes listener for specified events, if any.
`boolean` `removeLocalEventListener(IgnitePredicate<? extends Event> lsnr, int... types)` Removes user listener for specified events, if any.
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.
`<T extends Event> IgniteInternalFuture<T>` `waitForEvent(IgnitePredicate<T> p, int... types)`
`Event` `waitForEvent(long timeout, Runnable c, IgnitePredicate<? super Event> p, int... types)`

### Methods inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`assertParameter, collectDiscoveryData, discoveryDataType, enabled, getSpi, getSpi, getSpis, onAfterSpiStart, onBeforeSpiStart, onDisconnected, onDiscoveryDataReceived, onKernalStart, onKernalStart0, onKernalStop, onReconnected, startInfo, startSpi, stopInfo, stopSpi, toString, validateNode`

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

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

### Constructor Detail

#### GridEventStorageManager

    public GridEventStorageManager(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### printMemoryStats

    public void printMemoryStats()

Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridComponent`
Overrides:
  `printMemoryStats` in class `GridManagerAdapter<EventStorageSpi>`

#### onKernalStop0

    public void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `GridManagerAdapter<EventStorageSpi>`
Parameters:
  `cancel` - Cancel flag.

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

Parameters:
  `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### record

    public void record(Event evt)

Records event if it's recordable.

Parameters:
  `evt` - Event to record.

#### enabledEvents

    public int[] enabledEvents()

Gets types of enabled user-recordable events.

Returns:
  Array of types of enabled user-recordable events.

#### enableEvents

    public void enableEvents(int[] types)

Enables provided events.

Parameters:
  `types` - Events to enable.

#### disableEvents

    public void disableEvents(int[] types)

Disables provided events.

Parameters:
  `types` - Events to disable.

#### isUserRecordable

    public boolean isUserRecordable(int type)

Checks if the event type is user-recordable.

Parameters:
  `type` - Event type to check.
Returns:
  `true` if passed event should be recorded, `false` - otherwise.

#### isRecordable

    public boolean isRecordable(int type)

Checks whether this event type should be recorded. Note that internal event types are always recordable for notification purposes but may not be sent down to SPI level for storage and subsequent querying.

Parameters:
  `type` - Event type to check.
Returns:
  Whether or not this event type should be recorded.

#### isAllUserRecordable

    public boolean isAllUserRecordable(int[] types)

Checks whether all provided events are user-recordable.

Note that this method supports only predefined Ignite events.

Parameters:
  `types` - Event types.
Returns:
  Whether all events are recordable.
Throws:
  `IllegalArgumentException` - If `types` contains user event type.

#### addLocalEventListener

    public void addLocalEventListener(IgnitePredicate<? extends Event> lsnr,
                             int[] types)

Adds local user event listener.

Parameters:
  `lsnr` - User listener to add.
  `types` - Event types to subscribe listener for.

#### addLocalEventListener

    public void addLocalEventListener(GridLocalEventListener lsnr,
                             int[] types)

Adds local event listener. Note that this method specifically disallow an empty array of event type to prevent accidental subscription for all system event that may lead to a drastic performance decrease.

Parameters:
  `lsnr` - Listener to add.
  `types` - Event types to subscribe listener for.

#### addLocalEventListener

    public void addLocalEventListener(GridLocalEventListener lsnr,
                             int type,
                             @Nullable
                             int... types)

Adds local event listener.

Parameters:
  `lsnr` - Listener to add.
  `type` - Event type to subscribe listener for.
  `types` - Additional event types to subscribe listener for.

#### removeLocalEventListener

    public boolean removeLocalEventListener(IgnitePredicate<? extends Event> lsnr,
                                   @Nullable
                                   int... types)

Removes user listener for specified events, if any. If no event types provided - it removes the listener for all its registered events.

Parameters:
  `lsnr` - User listener predicate.
  `types` - Event types.
Returns:
  Returns `true` if removed.

#### removeLocalEventListener

    public boolean removeLocalEventListener(GridLocalEventListener lsnr,
                                   @Nullable
                                   int... types)

Removes listener for specified events, if any. If no event types provided - it remove the listener for all its registered events.

Parameters:
  `lsnr` - Listener.
  `types` - Event types.
Returns:
  Returns `true` if removed.

#### waitForEvent

    public <T extends Event> IgniteInternalFuture<T> waitForEvent(@Nullable
                                                         IgnitePredicate<T> p,
                                                         @Nullable
                                                         int... types)

Parameters:
  `p` - Optional predicate.
  `types` - Event types to wait for.
Returns:
  Event future.

#### waitForEvent

    public Event waitForEvent(long timeout,
                     @Nullable
                     Runnable c,
                     @Nullable
                     IgnitePredicate<? super Event> p,
                     int... types)
                       throws IgniteCheckedException

Parameters:
  `timeout` - Timeout.
  `c` - Optional continuation.
  `p` - Optional predicate.
  `types` - Event types to wait for.
Returns:
  Event.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### localEvents

    public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p)

Parameters:
  `p` - Grid event predicate.
Returns:
  Collection of grid events.

#### remoteEventsAsync

    public <T extends Event> IgniteInternalFuture<List<T>> remoteEventsAsync(IgnitePredicate<T> p,
                                                                    Collection<? extends ClusterNode> nodes,
                                                                    long timeout)

Parameters:
  `p` - Grid event predicate.
  `nodes` - Collection of nodes.
  `timeout` - Maximum time to wait for result, if `0`, then wait until result is received.
Returns:
  Collection of events.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.9.0
Release Date | : March 2 2017