Package org.apache.cassandra.concurrent
Class ImmediateExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- org.apache.cassandra.concurrent.ImmediateExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService,LocalAwareExecutorService,ResizableThreadPool
public class ImmediateExecutor extends java.util.concurrent.AbstractExecutorService implements LocalAwareExecutorService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.concurrent.LocalAwareExecutorService
LocalAwareExecutorService.MaximumPoolSizeListener
-
-
Field Summary
Fields Modifier and Type Field Description static ImmediateExecutorINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, java.util.concurrent.TimeUnit unit)voidexecute(java.lang.Runnable command)voidexecute(java.lang.Runnable command, ExecutorLocals locals)intgetActiveTaskCount()Returns the approximate number of threads that are actively executing tasks.longgetCompletedTaskCount()Returns the approximate total number of tasks that have completed execution.intgetCorePoolSize()Returns maximum pool size of thread pool.intgetMaximumPoolSize()Returns maximum pool size of thread pool.intgetPendingTaskCount()Returns the approximate total of tasks waiting to be executed.booleanisShutdown()booleanisTerminated()voidmaybeExecuteImmediately(java.lang.Runnable command)voidsetCorePoolSize(int newCorePoolSize)Allows user to resize maximum size of the thread pool.voidsetMaximumPoolSize(int newMaximumPoolSize)Allows user to resize maximum size of the thread pool.voidshutdown()java.util.List<java.lang.Runnable>shutdownNow()-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
-
Methods inherited from interface org.apache.cassandra.concurrent.LocalAwareExecutorService
getMaxTasksQueued
-
-
-
-
Field Detail
-
INSTANCE
public static final ImmediateExecutor INSTANCE
-
-
Method Detail
-
execute
public void execute(java.lang.Runnable command, ExecutorLocals locals)- Specified by:
executein interfaceLocalAwareExecutorService
-
maybeExecuteImmediately
public void maybeExecuteImmediately(java.lang.Runnable command)
- Specified by:
maybeExecuteImmediatelyin interfaceLocalAwareExecutorService
-
execute
public void execute(java.lang.Runnable command)
- Specified by:
executein interfacejava.util.concurrent.Executor
-
getActiveTaskCount
public int getActiveTaskCount()
Description copied from interface:LocalAwareExecutorServiceReturns the approximate number of threads that are actively executing tasks.- Specified by:
getActiveTaskCountin interfaceLocalAwareExecutorService- Returns:
- the number of threads
-
getCompletedTaskCount
public long getCompletedTaskCount()
Description copied from interface:LocalAwareExecutorServiceReturns 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:
getCompletedTaskCountin interfaceLocalAwareExecutorService- Returns:
- the number of tasks
-
getPendingTaskCount
public int getPendingTaskCount()
Description copied from interface:LocalAwareExecutorServiceReturns the approximate total of tasks waiting to be executed. 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:
getPendingTaskCountin interfaceLocalAwareExecutorService- Returns:
- the number of tasks
-
getCorePoolSize
public int getCorePoolSize()
Description copied from interface:ResizableThreadPoolReturns maximum pool size of thread pool.- Specified by:
getCorePoolSizein interfaceResizableThreadPool
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:ResizableThreadPoolReturns maximum pool size of thread pool.- Specified by:
getMaximumPoolSizein interfaceResizableThreadPool
-
setCorePoolSize
public void setCorePoolSize(int newCorePoolSize)
Description copied from interface:ResizableThreadPoolAllows user to resize maximum size of the thread pool.- Specified by:
setCorePoolSizein interfaceResizableThreadPool
-
setMaximumPoolSize
public void setMaximumPoolSize(int newMaximumPoolSize)
Description copied from interface:ResizableThreadPoolAllows user to resize maximum size of the thread pool.- Specified by:
setMaximumPoolSizein interfaceResizableThreadPool
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacejava.util.concurrent.ExecutorService
-
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
- Specified by:
shutdownNowin interfacejava.util.concurrent.ExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfacejava.util.concurrent.ExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfacejava.util.concurrent.ExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)- Specified by:
awaitTerminationin interfacejava.util.concurrent.ExecutorService
-
-