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 ImmediateExecutor
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
void
execute(java.lang.Runnable command)
void
execute(java.lang.Runnable command, ExecutorLocals locals)
int
getActiveTaskCount()
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 maximum pool size of thread pool.int
getMaximumPoolSize()
Returns maximum pool size of thread pool.int
getPendingTaskCount()
Returns the approximate total of tasks waiting to be executed.boolean
isShutdown()
boolean
isTerminated()
void
maybeExecuteImmediately(java.lang.Runnable command)
void
setCorePoolSize(int newCorePoolSize)
Allows user to resize maximum size of the thread pool.void
setMaximumPoolSize(int newMaximumPoolSize)
Allows user to resize maximum size of the thread pool.void
shutdown()
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:
execute
in interfaceLocalAwareExecutorService
-
maybeExecuteImmediately
public void maybeExecuteImmediately(java.lang.Runnable command)
- Specified by:
maybeExecuteImmediately
in interfaceLocalAwareExecutorService
-
execute
public void execute(java.lang.Runnable command)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
-
getActiveTaskCount
public int getActiveTaskCount()
Description copied from interface:LocalAwareExecutorService
Returns the approximate number of threads that are actively executing tasks.- Specified by:
getActiveTaskCount
in interfaceLocalAwareExecutorService
- Returns:
- the number of threads
-
getCompletedTaskCount
public long getCompletedTaskCount()
Description copied from interface:LocalAwareExecutorService
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 interfaceLocalAwareExecutorService
- Returns:
- the number of tasks
-
getPendingTaskCount
public int getPendingTaskCount()
Description copied from interface:LocalAwareExecutorService
Returns 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:
getPendingTaskCount
in interfaceLocalAwareExecutorService
- Returns:
- the number of tasks
-
getCorePoolSize
public int getCorePoolSize()
Description copied from interface:ResizableThreadPool
Returns maximum pool size of thread pool.- Specified by:
getCorePoolSize
in interfaceResizableThreadPool
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:ResizableThreadPool
Returns maximum pool size of thread pool.- Specified by:
getMaximumPoolSize
in interfaceResizableThreadPool
-
setCorePoolSize
public void setCorePoolSize(int newCorePoolSize)
Description copied from interface:ResizableThreadPool
Allows user to resize maximum size of the thread pool.- Specified by:
setCorePoolSize
in interfaceResizableThreadPool
-
setMaximumPoolSize
public void setMaximumPoolSize(int newMaximumPoolSize)
Description copied from interface:ResizableThreadPool
Allows user to resize maximum size of the thread pool.- Specified by:
setMaximumPoolSize
in interfaceResizableThreadPool
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacejava.util.concurrent.ExecutorService
-
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
- Specified by:
shutdownNow
in interfacejava.util.concurrent.ExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacejava.util.concurrent.ExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacejava.util.concurrent.ExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
- Specified by:
awaitTermination
in interfacejava.util.concurrent.ExecutorService
-
-