Package 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
AnExecutorServicethat executes submitted tasks using pooled grid threads.
-
-
Constructor Summary
Constructors Constructor 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 Description booleanawaitTermination(long timeout, TimeUnit unit)voidexecute(Runnable cmd)voidexecute(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> TinvokeAny(Collection<? extends Callable<T>> tasks)<T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)booleanisShutdown()booleanisTerminated()voidregisterMetrics(org.apache.ignite.internal.processors.metric.MetricRegistryImpl mreg)Register thread pool metrics.voidshutdown()List<Runnable>shutdownNow()@NotNull Future<?>submit(Runnable task)<T> @NotNull Future<T>submit(Runnable task, T res)<T> @NotNull Future<T>submit(Callable<T> task)intthreadId(int idx)StringtoString()
-
-
-
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 sameindexwill be executed in the same thread.- Parameters:
task- the runnable taskidx- 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:
shutdownin interfaceExecutorService
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
submit
@NotNull public <T> @NotNull Future<T> submit(Callable<T> task)
- Specified by:
submitin interfaceExecutorService
-
submit
@NotNull public <T> @NotNull Future<T> submit(Runnable task, T res)
- Specified by:
submitin interfaceExecutorService
-
submit
@NotNull public @NotNull Future<?> submit(Runnable task)
- Specified by:
submitin interfaceExecutorService
-
invokeAll
@NotNull public <T> @NotNull List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
- Specified by:
invokeAllin interfaceExecutorService
-
invokeAll
@NotNull public <T> @NotNull List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
- Specified by:
invokeAllin interfaceExecutorService
-
invokeAny
@NotNull public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
- Specified by:
invokeAnyin interfaceExecutorService
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
- Specified by:
invokeAnyin interfaceExecutorService
-
registerMetrics
public void registerMetrics(org.apache.ignite.internal.processors.metric.MetricRegistryImpl mreg)
Register thread pool metrics.- Specified by:
registerMetricsin interfaceorg.apache.ignite.internal.processors.pool.MetricsAwareExecutorService- Parameters:
mreg- Metrics registry.
-
-