org.apache.ignite.thread

## Class IgniteStripedThreadPoolExecutor

- java.lang.Object
- - org.apache.ignite.thread.IgniteStripedThreadPoolExecutor

- All Implemented Interfaces:
    Executor, ExecutorService, org.apache.ignite.internal.processors.pool.MetricsAwareExecutorService

      public class IgniteStripedThreadPoolExecutor
      extends Object
      implements ExecutorService, org.apache.ignite.internal.processors.pool.MetricsAwareExecutorService

  An `ExecutorService` that executes submitted tasks using pooled grid threads.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteStripedThreadPoolExecutor(int concurrentLvl, String igniteInstanceName, String threadNamePrefix, Thread.UncaughtExceptionHandler eHnd, boolean allowCoreThreadTimeOut, long keepAliveTime)` Create striped thread pool.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `awaitTermination(long timeout, TimeUnit unit)`
    `void` | `execute(Runnable cmd)`
    `void` | `execute(Runnable task, int idx)` Executes the given command at some time in the future.
    `<T> @NotNull List<Future<T>>` | `invokeAll(Collection<? extends Callable<T>> tasks)`
    `<T> @NotNull List<Future<T>>` | `invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)`
    `<T> T` | `invokeAny(Collection<? extends Callable<T>> tasks)`
    `<T> T` | `invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)`
    `boolean` | `isShutdown()`
    `boolean` | `isTerminated()`
    `void` | `registerMetrics(org.apache.ignite.internal.processors.metric.MetricRegistry mreg)` Register thread pool metrics.
    `void` | `shutdown()`
    `List<Runnable>` | `shutdownNow()`
    `<T> @NotNull Future<T>` | `submit(Callable<T> task)`
    `@NotNull Future<?>` | `submit(Runnable task)`
    `<T> @NotNull Future<T>` | `submit(Runnable task, T res)`
    `int` | `threadId(int idx)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### IgniteStripedThreadPoolExecutor

          public IgniteStripedThreadPoolExecutor(int concurrentLvl,
                                                 String igniteInstanceName,
                                                 String threadNamePrefix,
                                                 Thread.UncaughtExceptionHandler eHnd,
                                                 boolean allowCoreThreadTimeOut,
                                                 long keepAliveTime)

      Create striped thread pool.
      Parameters:
        `concurrentLvl` - Concurrency level.
        `igniteInstanceName` - Node name.
        `threadNamePrefix` - Thread name prefix.
        `allowCoreThreadTimeOut` - Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time.
        `keepAliveTime` - When the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
        `eHnd` - Uncaught exception handler.

  - ### Method Detail

    - #### execute

          public void execute(Runnable task,
                              int idx)

      Executes the given command at some time in the future. The command with the same `index` will be executed in the same thread.
      Parameters:
        `task` - the runnable task
        `idx` - Striped index.
      Throws:
        `RejectedExecutionException` - if this task cannot be accepted for execution.
        `NullPointerException` - If command is null

    - #### threadId

          public int threadId(int idx)

      Parameters:
        `idx` - Index.
      Returns:
        Stripped thread ID.

    - #### shutdown

          public void shutdown()

      Specified by:
        `shutdown` in interface `ExecutorService`

    - #### shutdownNow

          public List<Runnable> shutdownNow()

      Specified by:
        `shutdownNow` in interface `ExecutorService`

    - #### isShutdown

          public boolean isShutdown()

      Specified by:
        `isShutdown` in interface `ExecutorService`

    - #### isTerminated

          public boolean isTerminated()

      Specified by:
        `isTerminated` in interface `ExecutorService`

    - #### awaitTermination

          public boolean awaitTermination(long timeout,
                                          TimeUnit unit)
                                   throws InterruptedException

      Specified by:
        `awaitTermination` in interface `ExecutorService`
      Throws:
        `InterruptedException`

    - #### submit

          @NotNull
          public <T> @NotNull Future<T> submit(Callable<T> task)

      Specified by:
        `submit` in interface `ExecutorService`

    - #### submit

          @NotNull
          public <T> @NotNull Future<T> submit(Runnable task,
                                                        T res)

      Specified by:
        `submit` in interface `ExecutorService`

    - #### submit

          @NotNull
          public @NotNull Future<?> submit(Runnable task)

      Specified by:
        `submit` in interface `ExecutorService`

    - #### invokeAll

          @NotNull
          public <T> @NotNull List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)

      Specified by:
        `invokeAll` in interface `ExecutorService`

    - #### invokeAll

          @NotNull
          public <T> @NotNull List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks,
                                                                 long timeout,
                                                                 TimeUnit unit)

      Specified by:
        `invokeAll` in interface `ExecutorService`

    - #### invokeAny

          @NotNull
          public <T> T invokeAny(Collection<? extends Callable<T>> tasks)

      Specified by:
        `invokeAny` in interface `ExecutorService`

    - #### invokeAny

          public <T> T invokeAny(Collection<? extends Callable<T>> tasks,
                                 long timeout,
                                 TimeUnit unit)

      Specified by:
        `invokeAny` in interface `ExecutorService`

    - #### execute

          public void execute(Runnable cmd)

      Specified by:
        `execute` in interface `Executor`

    - #### registerMetrics

          public void registerMetrics(org.apache.ignite.internal.processors.metric.MetricRegistry mreg)

      Register thread pool metrics.
      Specified by:
        `registerMetrics` in interface `org.apache.ignite.internal.processors.pool.MetricsAwareExecutorService`
      Parameters:
        `mreg` - Metrics registry.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022