Package org.apache.cassandra.concurrent
Class SEPExecutor
- java.lang.Object
-
- org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService
-
- org.apache.cassandra.concurrent.SEPExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,LocalAwareExecutorService
,ResizableThreadPool
,SEPExecutorMBean
public class SEPExecutor extends AbstractLocalAwareExecutorService implements SEPExecutorMBean
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SEPExecutor.TakeTaskPermitResult
-
Nested classes/interfaces inherited from interface org.apache.cassandra.concurrent.LocalAwareExecutorService
LocalAwareExecutorService.MaximumPoolSizeListener
-
-
Field Summary
Fields Modifier and Type Field Description ThreadPoolMetrics
metrics
java.lang.String
name
protected java.util.concurrent.ConcurrentLinkedQueue<org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService.FutureTask<?>>
tasks
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTask(org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService.FutureTask<?> task)
boolean
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
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
getMaxTasksQueued()
int
getPendingTaskCount()
Returns the approximate total of tasks waiting to be executed.boolean
isShutdown()
boolean
isTerminated()
void
maybeExecuteImmediately(java.lang.Runnable command)
protected void
onCompletion()
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 org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService
execute, execute, invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Field Detail
-
name
public final java.lang.String name
-
metrics
public final ThreadPoolMetrics metrics
-
tasks
protected final java.util.concurrent.ConcurrentLinkedQueue<org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService.FutureTask<?>> tasks
-
-
Method Detail
-
onCompletion
protected void onCompletion()
- Specified by:
onCompletion
in classAbstractLocalAwareExecutorService
-
getMaxTasksQueued
public int getMaxTasksQueued()
- Specified by:
getMaxTasksQueued
in interfaceLocalAwareExecutorService
-
addTask
protected void addTask(org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService.FutureTask<?> task)
- Specified by:
addTask
in classAbstractLocalAwareExecutorService
-
maybeExecuteImmediately
public void maybeExecuteImmediately(java.lang.Runnable command)
- Specified by:
maybeExecuteImmediately
in interfaceLocalAwareExecutorService
-
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) throws java.lang.InterruptedException
- Specified by:
awaitTermination
in interfacejava.util.concurrent.ExecutorService
- Throws:
java.lang.InterruptedException
-
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
-
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
-
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
-
getCorePoolSize
public int getCorePoolSize()
Description copied from interface:ResizableThreadPool
Returns maximum pool size of thread pool.- Specified by:
getCorePoolSize
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
-
getMaximumPoolSize
public int getMaximumPoolSize()
Description copied from interface:ResizableThreadPool
Returns maximum pool size of thread pool.- Specified by:
getMaximumPoolSize
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
-
-