Package org.apache.ignite.internal.processors.query.stat

## Class BusyExecutor

- java.lang.Object
- - org.apache.ignite.internal.processors.query.stat.BusyExecutor

    public class BusyExecutor
    extends Object

Executor with busy run support. Can run any tasks while active and safelly wait untill they stopped.

### Constructor Summary

Constructors
`BusyExecutor​(String name, IgniteThreadPoolExecutor pool, Supplier<Boolean> stopping, Function<Class<?>,​IgniteLogger> logSupplier)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `activate()` Allow operations.
`boolean` `busyRun​(Runnable r)` Run task on busy lock.
`void` `deactivate()` Stop all running tasks.
`void` `execute​(Runnable r)` Execute task in thread pool under busy lock.
`void` `execute​(CancellableTask ct)` Execute cancellable task in thread pool under busy lock.
`CompletableFuture<Boolean>` `submit​(Runnable r)` Submit task to execute in thread pool under busy lock.

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

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

### Constructor Detail

#### BusyExecutor

    public BusyExecutor​(String name,
                        IgniteThreadPoolExecutor pool,
                        Supplier<Boolean> stopping,
                        Function<Class<?>,​IgniteLogger> logSupplier)

Constructor.

Parameters:
  `name` - Executor name.
  `pool` - Underlying thread pool executor.
  `stopping` - External stopping state supplier.
  `logSupplier` - Log supplier.

### Method Detail

#### activate

    public void activate()

Allow operations.

#### deactivate

    public void deactivate()

Stop all running tasks. Block new task scheduling, execute cancell runnable and wait till each task stops.

#### busyRun

    public boolean busyRun​(Runnable r)

Run task on busy lock.

Parameters:
  `r` - Task to run.
Returns:
  `true` if task was succesfully scheduled, `false` - otherwise (due to inactive state).

#### submit

    public CompletableFuture<Boolean> submit​(Runnable r)

Submit task to execute in thread pool under busy lock. Task surrounded with try/catch and if it's complete with any exception - resulting future will return

Parameters:
  `r` - Task to execute.
Returns:
  Completable future with executed flag in result.

#### execute

    public void execute​(Runnable r)

Execute task in thread pool under busy lock.

Parameters:
  `r` - Task to execute.

#### execute

    public void execute​(CancellableTask ct)

Execute cancellable task in thread pool under busy lock. Track task to cancel on executor stop.

Parameters:
  `ct` - Cancellable task to execute.