Package com.alipay.sofa.common.thread
Class SofaScheduledThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ScheduledThreadPoolExecutor
com.alipay.sofa.common.thread.SofaScheduledThreadPoolExecutor
- All Implemented Interfaces:
Executor
,ExecutorService
,ScheduledExecutorService
Sofa thread pool based on
ScheduledThreadPoolExecutor
- Version:
- SofaScheduledThreadPoolExecutor.java, v 0.1 2020年11月09日 2:19 下午 huzijie Exp $
- Author:
- huzijie
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Constructor Summary
ConstructorDescriptionSofaScheduledThreadPoolExecutor
(int corePoolSize) SofaScheduledThreadPoolExecutor
(int corePoolSize, String threadPoolName) SofaScheduledThreadPoolExecutor
(int corePoolSize, String threadPoolName, String spaceName) SofaScheduledThreadPoolExecutor
(int corePoolSize, RejectedExecutionHandler handler) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, long taskTimeout, long period, TimeUnit timeUnit) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, String spaceName) SofaScheduledThreadPoolExecutor
(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, String spaceName, long taskTimeout, long period, TimeUnit timeUnit) Basic constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
afterExecute
(Runnable r, Throwable t) protected void
beforeExecute
(Thread t, Runnable r) void
void
void
protected void
void
updatePeriod
(long period) void
updatespaceName
(String spaceName) void
updateTaskTimeout
(long taskTimeout) void
updateThreadPoolName
(String threadPoolName) Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submit
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, toString
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
-
Constructor Details
-
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, String spaceName, long taskTimeout, long period, TimeUnit timeUnit) Basic constructor- Parameters:
corePoolSize
- same as inScheduledThreadPoolExecutor
threadFactory
- same as inScheduledThreadPoolExecutor
handler
- same as inScheduledThreadPoolExecutor
threadPoolName
- name of this thread poolspaceName
- spaceName of this tread pooltaskTimeout
- task execution timeoutperiod
- task checking and logging periodtimeUnit
- unit of taskTimeout and period
-
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, long taskTimeout, long period, TimeUnit timeUnit) -
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName, String spaceName) -
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, String threadPoolName) -
SofaScheduledThreadPoolExecutor
-
SofaScheduledThreadPoolExecutor
-
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize) -
SofaScheduledThreadPoolExecutor
-
SofaScheduledThreadPoolExecutor
-
SofaScheduledThreadPoolExecutor
public SofaScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
-
Method Details
-
beforeExecute
- Overrides:
beforeExecute
in classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecute
in classThreadPoolExecutor
-
terminated
protected void terminated()- Overrides:
terminated
in classThreadPoolExecutor
-
startSchedule
public void startSchedule() -
stopSchedule
public void stopSchedule() -
reschedule
public void reschedule() -
updateThreadPoolName
-
updatespaceName
-
updatePeriod
public void updatePeriod(long period) -
updateTaskTimeout
public void updateTaskTimeout(long taskTimeout) -
getConfig
-
getStatistics
-