org.elasticsearch.threadpool.support
Class AbstractThreadPool
java.lang.Object
org.elasticsearch.common.component.AbstractComponent
org.elasticsearch.threadpool.support.AbstractThreadPool
- All Implemented Interfaces:
- java.util.concurrent.Executor, ThreadPool
- Direct Known Subclasses:
- BlockingThreadPool, CachedThreadPool, ScalingThreadPool
public abstract class AbstractThreadPool
- extends AbstractComponent
- implements ThreadPool
Method Summary |
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.Executor |
cached()
Returns a cached executor that will always allocate threads. |
void |
execute(java.lang.Runnable command)
|
abstract java.lang.String |
getType()
|
ThreadPoolInfo |
info()
|
boolean |
isStarted()
Returns true if the thread pool has started. |
<V> java.util.concurrent.ScheduledFuture<V> |
|
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable command,
TimeValue delay)
|
java.util.concurrent.ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit)
|
java.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
TimeValue interval)
|
void |
shutdown()
Initiates an orderly shutdown in which previously submitted
tasks are executed, but no new tasks will be accepted. |
void |
shutdownNow()
|
ThreadPoolStats |
stats()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
started
protected volatile boolean started
executorService
protected java.util.concurrent.ExecutorService executorService
scheduledExecutorService
protected java.util.concurrent.ScheduledExecutorService scheduledExecutorService
cached
protected java.util.concurrent.ExecutorService cached
AbstractThreadPool
protected AbstractThreadPool(Settings settings)
getType
public abstract java.lang.String getType()
info
public ThreadPoolInfo info()
- Specified by:
info
in interface ThreadPool
stats
public ThreadPoolStats stats()
- Specified by:
stats
in interface ThreadPool
isStarted
public boolean isStarted()
- Description copied from interface:
ThreadPool
- Returns true if the thread pool has started.
- Specified by:
isStarted
in interface ThreadPool
cached
public java.util.concurrent.Executor cached()
- Description copied from interface:
ThreadPool
- Returns a cached executor that will always allocate threads.
- Specified by:
cached
in interface ThreadPool
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit)
- Specified by:
schedule
in interface ThreadPool
schedule
public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit)
- Specified by:
schedule
in interface ThreadPool
scheduleAtFixedRate
public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
- Specified by:
scheduleAtFixedRate
in interface ThreadPool
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit)
- Specified by:
scheduleWithFixedDelay
in interface ThreadPool
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command,
TimeValue interval)
- Specified by:
scheduleWithFixedDelay
in interface ThreadPool
shutdown
public void shutdown()
- Description copied from interface:
ThreadPool
- Initiates an orderly shutdown in which previously submitted
tasks are executed, but no new tasks will be accepted.
Invocation has no additional effect if already shut down.
- Specified by:
shutdown
in interface ThreadPool
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interface ThreadPool
awaitTermination
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
- Specified by:
awaitTermination
in interface ThreadPool
- Throws:
java.lang.InterruptedException
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command,
TimeValue delay)
- Specified by:
schedule
in interface ThreadPool
execute
public void execute(java.lang.Runnable command)
- Specified by:
execute
in interface java.util.concurrent.Executor
- Specified by:
execute
in interface ThreadPool