org.apache.ignite.spi

## Class IgniteSpiThread

- java.lang.Object
- - java.lang.Thread
  - - org.apache.ignite.thread.IgniteThread
    - - org.apache.ignite.spi.IgniteSpiThread

- All Implemented Interfaces:
    Runnable

      public abstract class IgniteSpiThread
      extends IgniteThread

  This class provides convenient adapter for threads used by SPIs. This class adds necessary plumbing on top of the `IgniteThread` class:
  - Proper exception handling in `body()`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `Thread.State, Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.thread.IgniteThread

      `GRP_IDX_UNASSIGNED, igniteInstanceName`

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `IgniteSpiThread(String igniteInstanceName, String name, IgniteLogger log)` Creates thread with given `name`.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `body()` Body of SPI thread.
    `protected void` | `cleanup()` Should be overridden by child classes if cleanup logic is required.
    `void` | `run()`
    `String` | `toString()`

    - ### Methods inherited from class org.apache.ignite.thread.IgniteThread

      `cachePoolThread, compositeRwLockIndex, compositeRwLockIndex, createName, current, currentThreadCanRequestBinaryMetadata, getIgniteInstanceName, isForbiddenToRequestBinaryMetadata, onEntryProcessorEntered, onEntryProcessorLeft, onForbidBinaryMetadataRequestSectionEntered, onForbidBinaryMetadataRequestSectionLeft, policy, stripe`

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

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield`

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

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

- - ### Constructor Detail

    - #### IgniteSpiThread

          protected IgniteSpiThread(String igniteInstanceName,
                                    String name,
                                    IgniteLogger log)

      Creates thread with given `name`.
      Parameters:
        `igniteInstanceName` - Name of grid this thread is created in.
        `name` - Thread's name.
        `log` - Grid logger to use.

  - ### Method Detail

    - #### run

          public final void run()

      Specified by:
        `run` in interface `Runnable`
      Overrides:
        `run` in class `Thread`

    - #### cleanup

          protected void cleanup()

      Should be overridden by child classes if cleanup logic is required.

    - #### body

          protected abstract void body()
                                throws InterruptedException

      Body of SPI thread.
      Throws:
        `InterruptedException` - If thread got interrupted.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `IgniteThread`

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