org.apache.ignite.internal.util

## Class StripedExecutor

- java.lang.Object
- - org.apache.ignite.internal.util.StripedExecutor

All Implemented Interfaces:
  Executor, ExecutorService

    public class StripedExecutor
    extends Object
    implements ExecutorService

Striped executor.

### Constructor Summary

Constructors
Constructor and Description
`StripedExecutor(int cnt, String igniteInstanceName, String poolName, IgniteLogger log, IgniteInClosure<Throwable> errHnd, boolean stealTasks, GridWorkerListener gridWorkerLsnr)`
`StripedExecutor(int cnt, String igniteInstanceName, String poolName, IgniteLogger log, IgniteInClosure<Throwable> errHnd, GridWorkerListener gridWorkerLsnr)`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `activeStripesCount()`
`boolean` `awaitTermination(long timeout, TimeUnit unit)`
`void` `checkStarvation()` Checks starvation in striped pool.
`long` `completedTasks()`
`void` `execute(int idx, Runnable cmd)` Execute command.
`void` `execute(Runnable cmd)`
`<T> List<Future<T>>` `invokeAll(Collection<? extends Callable<T>> tasks)` Operation not supported.
`<T> List<Future<T>>` `invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)` Operation not supported.
`<T> T` `invokeAny(Collection<? extends Callable<T>> tasks)` Operation not supported.
`<T> T` `invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)` Operation not supported.
`boolean` `isShutdown()`
`boolean` `isTerminated()`
`int` `queueSize()`
`void` `shutdown()`
`List<Runnable>` `shutdownNow()`
`void` `stop()` Stops executor.
`int` `stripes()`
`boolean[]` `stripesActiveStatuses()`
`long[]` `stripesCompletedTasks()`
`int[]` `stripesQueueSizes()`
`<T> Future<T>` `submit(Callable<T> task)` Operation not supported.
`Future<?>` `submit(Runnable task)` Operation not supported.
`<T> Future<T>` `submit(Runnable task, T res)` Operation not supported.
`String` `toString()`

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

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

### Constructor Detail

#### StripedExecutor

    public StripedExecutor(int cnt,
                           String igniteInstanceName,
                           String poolName,
                           IgniteLogger log,
                           IgniteInClosure<Throwable> errHnd,
                           GridWorkerListener gridWorkerLsnr)

Parameters:
  `cnt` - Count.
  `igniteInstanceName` - Node name.
  `poolName` - Pool name.
  `log` - Logger.
  `errHnd` - Critical failure handler.
  `gridWorkerLsnr` - Listener to link with every stripe worker.

#### StripedExecutor

    public StripedExecutor(int cnt,
                           String igniteInstanceName,
                           String poolName,
                           IgniteLogger log,
                           IgniteInClosure<Throwable> errHnd,
                           boolean stealTasks,
                           GridWorkerListener gridWorkerLsnr)

Parameters:
  `cnt` - Count.
  `igniteInstanceName` - Node name.
  `poolName` - Pool name.
  `log` - Logger.
  `errHnd` - Critical failure handler.
  `stealTasks` - `True` to steal tasks.
  `gridWorkerLsnr` - listener to link with every stripe worker.

### Method Detail

#### checkStarvation

    public void checkStarvation()

Checks starvation in striped pool. Maybe too verbose but this is needed to faster debug possible issues.

#### stripes

    public int stripes()

Returns:
  Stripes count.

#### execute

    public void execute(int idx,
                        Runnable cmd)

Execute command.

Parameters:
  `idx` - Index.
  `cmd` - Command.

#### shutdown

    public void shutdown()

Specified by:
  `shutdown` in interface `ExecutorService`

#### execute

    public void execute(@NotNull
                        Runnable cmd)

Specified by:
  `execute` in interface `Executor`

#### shutdownNow

    @NotNull
    public List<Runnable> shutdownNow()

Specified by:
  `shutdownNow` in interface `ExecutorService`
Returns:
  Empty list (always).

#### awaitTermination

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

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

#### isShutdown

    public boolean isShutdown()

Specified by:
  `isShutdown` in interface `ExecutorService`

#### isTerminated

    public boolean isTerminated()

Specified by:
  `isTerminated` in interface `ExecutorService`

#### stop

    public void stop()

Stops executor.

#### queueSize

    public int queueSize()

Returns:
  Return total queue size of all stripes.

#### completedTasks

    public long completedTasks()

Returns:
  Completed tasks count.

#### stripesCompletedTasks

    public long[] stripesCompletedTasks()

Returns:
  Completed tasks per stripe count.

#### stripesActiveStatuses

    public boolean[] stripesActiveStatuses()

Returns:
  Number of active tasks per stripe.

#### activeStripesCount

    public int activeStripesCount()

Returns:
  Number of active tasks.

#### stripesQueueSizes

    public int[] stripesQueueSizes()

Returns:
  Size of queue per stripe.

#### submit

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

Operation not supported.

Specified by:
  `submit` in interface `ExecutorService`

#### submit

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

Operation not supported.

Specified by:
  `submit` in interface `ExecutorService`

#### submit

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

Operation not supported.

Specified by:
  `submit` in interface `ExecutorService`

#### invokeAll

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

Operation not supported.

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

#### invokeAll

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

Operation not supported.

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

#### invokeAny

    @NotNull
    public <T> T invokeAny(@NotNull
                                    Collection<? extends Callable<T>> tasks)
                             throws InterruptedException,
                                    ExecutionException

Operation not supported.

Specified by:
  `invokeAny` in interface `ExecutorService`
Throws:
  `InterruptedException`
  `ExecutionException`

#### invokeAny

    public <T> T invokeAny(@NotNull
                           Collection<? extends Callable<T>> tasks,
                           long timeout,
                           @NotNull
                           TimeUnit unit)
                    throws InterruptedException,
                           ExecutionException,
                           TimeoutException

Operation not supported.

Specified by:
  `invokeAny` in interface `ExecutorService`
Throws:
  `InterruptedException`
  `ExecutionException`
  `TimeoutException`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.5
Release Date | : June 4 2019