org.apache.ignite.internal

## Class ThreadPoolMXBeanAdapter

- java.lang.Object
- - org.apache.ignite.internal.ThreadPoolMXBeanAdapter

All Implemented Interfaces:
  ThreadPoolMXBean

    public class ThreadPoolMXBeanAdapter
    extends Object
    implements ThreadPoolMXBean

Adapter for `ThreadPoolMXBean` which delegates all method calls to the underlying `ExecutorService` instance.

### Constructor Summary

Constructors
Constructor and Description
`ThreadPoolMXBeanAdapter(ExecutorService exec)` Creates adapter.

### Method Summary

Methods
`int` `getActiveCount()` Returns the approximate number of threads that are actively executing tasks.
`long` `getCompletedTaskCount()` Returns the approximate total number of tasks that have completed execution.
`int` `getCorePoolSize()` Returns the core number of threads.
`long` `getKeepAliveTime()` Returns the thread keep-alive time, which is the amount of time which threads in excess of the core pool size may remain idle before being terminated.
`int` `getLargestPoolSize()` Returns the largest number of threads that have ever simultaneously been in the pool.
`int` `getMaximumPoolSize()` Returns the maximum allowed number of threads.
`int` `getPoolSize()` Returns the current number of threads in the pool.
`int` `getQueueSize()` Gets current size of the execution queue.
`String` `getRejectedExecutionHandlerClass()` Returns the class name of current rejection handler.
`long` `getTaskCount()` Returns the approximate total number of tasks that have been scheduled for execution.
`String` `getThreadFactoryClass()` Returns the class name of thread factory used to create new threads.
`boolean` `isShutdown()` Returns `true` if this executor has been shut down.
`boolean` `isTerminated()` Returns `true` if all tasks have completed following shut down.
`boolean` `isTerminating()` Returns `true` if this executor is in the process of terminating after `shutdown()` or `shutdownNow()` but has not completely terminated.
`String` `toString()`

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

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

### Constructor Detail

#### ThreadPoolMXBeanAdapter

    public ThreadPoolMXBeanAdapter(ExecutorService exec)

Creates adapter.

Parameters:
  `exec` - Executor service

### Method Detail

#### getActiveCount

    public int getActiveCount()

Returns the approximate number of threads that are actively executing tasks.

Specified by:
  `getActiveCount` in interface `ThreadPoolMXBean`
Returns:
  The number of threads.

#### getCompletedTaskCount

    public long getCompletedTaskCount()

Returns the approximate total number of tasks that have completed execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls.

Specified by:
  `getCompletedTaskCount` in interface `ThreadPoolMXBean`
Returns:
  The number of tasks.

#### getCorePoolSize

    public int getCorePoolSize()

Returns the core number of threads.

Specified by:
  `getCorePoolSize` in interface `ThreadPoolMXBean`
Returns:
  The core number of threads.

#### getLargestPoolSize

    public int getLargestPoolSize()

Returns the largest number of threads that have ever simultaneously been in the pool.

Specified by:
  `getLargestPoolSize` in interface `ThreadPoolMXBean`
Returns:
  The number of threads.

#### getMaximumPoolSize

    public int getMaximumPoolSize()

Returns the maximum allowed number of threads.

Specified by:
  `getMaximumPoolSize` in interface `ThreadPoolMXBean`
Returns:
  The maximum allowed number of threads.

#### getPoolSize

    public int getPoolSize()

Returns the current number of threads in the pool.

Specified by:
  `getPoolSize` in interface `ThreadPoolMXBean`
Returns:
  The number of threads.

#### getTaskCount

    public long getTaskCount()

Returns the approximate total number of tasks that have been scheduled for execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls.

Specified by:
  `getTaskCount` in interface `ThreadPoolMXBean`
Returns:
  The number of tasks.

#### getQueueSize

    public int getQueueSize()

Gets current size of the execution queue. This queue buffers local executions when there are not threads available for processing in the pool.

Specified by:
  `getQueueSize` in interface `ThreadPoolMXBean`
Returns:
  Current size of the execution queue.

#### getKeepAliveTime

    public long getKeepAliveTime()

Returns the thread keep-alive time, which is the amount of time which threads in excess of the core pool size may remain idle before being terminated.

Specified by:
  `getKeepAliveTime` in interface `ThreadPoolMXBean`
Returns:
  Keep alive time.

#### isShutdown

    public boolean isShutdown()

Returns `true` if this executor has been shut down.

Specified by:
  `isShutdown` in interface `ThreadPoolMXBean`
Returns:
  `True` if this executor has been shut down.

#### isTerminated

    public boolean isTerminated()

Returns `true` if all tasks have completed following shut down. Note that `isTerminated()` is never `true` unless either `shutdown()` or `shutdownNow()` was called first.

Specified by:
  `isTerminated` in interface `ThreadPoolMXBean`
Returns:
  `True` if all tasks have completed following shut down.

#### isTerminating

    public boolean isTerminating()

Returns `true` if this executor is in the process of terminating after `shutdown()` or `shutdownNow()` but has not completely terminated. This method may be useful for debugging. A return of `true` reported a sufficient period after shutdown may indicate that submitted tasks have ignored or suppressed interruption, causing this executor not to properly terminate.

Specified by:
  `isTerminating` in interface `ThreadPoolMXBean`
Returns:
  `True` if terminating but not yet terminated.

#### getRejectedExecutionHandlerClass

    public String getRejectedExecutionHandlerClass()

Returns the class name of current rejection handler.

Specified by:
  `getRejectedExecutionHandlerClass` in interface `ThreadPoolMXBean`
Returns:
  Class name of current rejection handler.

#### getThreadFactoryClass

    public String getThreadFactoryClass()

Returns the class name of thread factory used to create new threads.

Specified by:
  `getThreadFactoryClass` in interface `ThreadPoolMXBean`
Returns:
  Class name of thread factory used to create new threads.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.1.0-incubating
Release Date | : May 20 2015