org.apache.ignite.spi.collision.noop

## Class NoopCollisionSpi

- java.lang.Object
- - org.apache.ignite.spi.IgniteSpiAdapter
  - - org.apache.ignite.spi.collision.noop.NoopCollisionSpi

- All Implemented Interfaces:
    CollisionSpi, IgniteSpi

      @IgniteSpiNoop
       @IgniteSpiMultipleInstancesSupport(value=true)
      public class NoopCollisionSpi
      extends IgniteSpiAdapter
      implements CollisionSpi

  No-op implementation of `CollisionSpi`. This is default implementation since `4.5.0` version. When grid is started with `NoopCollisionSpi` jobs are activated immediately on arrival to mapped node. This approach suits well for large amount of small jobs (which is a wide-spread use case). User still can control the number of concurrent jobs by setting maximum thread pool size defined by `IgniteConfiguration.getPublicThreadPoolSize()` configuration property.

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `ignite, igniteInstanceName, log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NoopCollisionSpi()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onCollision(CollisionContext ctx)` This is a callback called: new grid job arrived executing job finished its execution topology changed periodically (on `EventType.EVT_NODE_METRICS_UPDATED`) When new job arrives it is added to the end of the wait list and this method is called.
    `void` | `setExternalCollisionListener(@Nullable CollisionExternalListener lsnr)` Listener to be set for notification of external collision events (e.g. job stealing).
    `NoopCollisionSpi` | `setName(String name)` Sets SPI name.
    `void` | `spiStart(@Nullable String igniteInstanceName)` This method is called to start SPI.
    `void` | `spiStop()` This method is called to stop SPI.
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean`

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

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

    - ### Methods inherited from interface org.apache.ignite.spi.IgniteSpi

      `getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized`

- - ### Constructor Detail

    - #### NoopCollisionSpi

          public NoopCollisionSpi()

  - ### Method Detail

    - #### spiStart

          public void spiStart(@Nullable
                               @Nullable String igniteInstanceName)
                        throws IgniteSpiException

      This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.
      Specified by:
        `spiStart` in interface `IgniteSpi`
      Parameters:
        `igniteInstanceName` - Name of Ignite instance this SPI is being started for (`null` for default Ignite instance).
      Throws:
        `IgniteSpiException` - Throws in case of any error during SPI start.

    - #### spiStop

          public void spiStop()
                       throws IgniteSpiException

      This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

      Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

      Specified by:
        `spiStop` in interface `IgniteSpi`
      Throws:
        `IgniteSpiException` - Thrown in case of any error during SPI stop.

    - #### onCollision

          public void onCollision(CollisionContext ctx)

      This is a callback called:
      - new grid job arrived
      - executing job finished its execution
      - topology changed
      - periodically (on `EventType.EVT_NODE_METRICS_UPDATED`)
      When new job arrives it is added to the end of the wait list and this method is called. When job finished its execution, it is removed from the active list and this method is called (i.e., when grid job is finished it will not appear in any list in collision resolution).

      Implementation of this method should act on all lists, each of which contains collision job contexts that define a set of operations available during collision resolution. Refer to `CollisionContext` and `CollisionJobContext` documentation for more information.

      Specified by:
        `onCollision` in interface `CollisionSpi`
      Parameters:
        `ctx` - Collision context which contains all collision lists.

    - #### setExternalCollisionListener

          public void setExternalCollisionListener(@Nullable
                                                   @Nullable CollisionExternalListener lsnr)

      Listener to be set for notification of external collision events (e.g. job stealing). Once grid receives such notification, it will immediately invoke collision SPI.

      Ignite uses this listener to enable job stealing from overloaded to underloaded nodes. However, you can also utilize it, for instance, to provide time based collision resolution. To achieve this, you most likely would mark some job by setting a certain attribute in job context (see `ComputeJobContext`) for a job that requires time-based scheduling and set some timer in your SPI implementation that would wake up after a certain period of time. Once this period is reached, you would notify this listener that a collision resolution should take place. Then inside of your collision resolution logic, you would find the marked waiting job and activate it.

      Note that most collision SPI's might not have external collisions. In that case, they should simply ignore this method and do nothing when listener is set.

      Specified by:
        `setExternalCollisionListener` in interface `CollisionSpi`
      Parameters:
        `lsnr` - Listener for external collision events.

    - #### setName

          public NoopCollisionSpi setName(String name)

      Sets SPI name.
      Overrides:
        `setName` in class `IgniteSpiAdapter`
      Parameters:
        `name` - SPI name.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020