public class ThreadPoolGovernor extends Object
ThreadPoolExecutors| Modifier and Type | Field and Description |
|---|---|
static String |
CLASS_NAME |
| Modifier and Type | Method and Description |
|---|---|
long |
getGovernorPeriod()
The period of the dump task
|
static ThreadPoolGovernor |
getInstance() |
ScheduledExecutorService |
getMonitorScheduler()
The thread pool to executor the monitor tasks
|
int |
getSpaceNameThreadPoolNumber(String spaceName)
return the spaceName thread pool number,it will increase after witch get
return 0 when the spaceName has not registered
|
ThreadPoolExecutor |
getThreadPoolExecutor(String identity)
Get the
ThreadPoolExecutor by it's identity |
ThreadPoolMonitorWrapper |
getThreadPoolMonitorWrapper(String identity)
Get the
ThreadPoolMonitorWrapper by it's identity |
boolean |
isGlobalMonitorLoggable()
The log switch of the all monitor task
|
boolean |
isGovernorLoggable()
The log switch of the dump task
|
void |
registerThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor,
ThreadPoolConfig threadPoolConfig,
ThreadPoolStatistics threadPoolStatistics)
|
void |
restartMonitorThreadPool(String identity)
Restart the monitor the
ThreadPoolExecutor registered in the governor |
void |
setGlobalMonitorLoggable(boolean globalMonitorLoggable)
Update the log switch of the all monitor task
|
void |
setGovernorLoggable(boolean governorLoggable)
Update the log switch of the dump task
|
void |
setGovernorPeriod(long governorPeriod)
update the period of the dump task, then restart the task
|
void |
setMonitorThreadPoolBySpaceName(String spaceName,
long period)
update the monitor params and restart all thread pool in the spaceName
|
void |
startGovernorSchedule()
Start the governor info dump task
|
void |
startMonitorThreadPool(String identity)
Start the monitor the
ThreadPoolExecutor registered in the governor |
void |
startMonitorThreadPoolBySpaceName(String spaceName)
start monitor all thread pool in the spaceName
|
void |
stopGovernorSchedule()
Stop the governor info dump task
|
void |
stopMonitorThreadPool(String identity)
Stop to monitor the
ThreadPoolExecutor registered in the governor |
void |
stopMonitorThreadPoolBySpaceName(String spaceName)
stop monitor all thread pool in the spaceName
|
void |
unregisterThreadPoolExecutor(ThreadPoolConfig threadPoolConfig)
Unregister the
ThreadPoolExecutor by it's ThreadPoolConfig |
public static String CLASS_NAME
public static ThreadPoolGovernor getInstance()
public void startGovernorSchedule()
public void stopGovernorSchedule()
public long getGovernorPeriod()
public void setGovernorPeriod(long governorPeriod)
governorPeriod - the dump task periodpublic boolean isGovernorLoggable()
public void setGovernorLoggable(boolean governorLoggable)
governorLoggable - whether log the dumppublic boolean isGlobalMonitorLoggable()
public void setGlobalMonitorLoggable(boolean globalMonitorLoggable)
globalMonitorLoggable - whether log monitor taskpublic void registerThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor, ThreadPoolConfig threadPoolConfig, ThreadPoolStatistics threadPoolStatistics)
threadPoolExecutor - the base thread poolthreadPoolConfig - the description of the thread poolthreadPoolStatistics - the running statistics of the thread poolpublic void unregisterThreadPoolExecutor(ThreadPoolConfig threadPoolConfig)
ThreadPoolExecutor by it's ThreadPoolConfigthreadPoolConfig - the description of the thread pool, it's identity is uniquepublic ThreadPoolExecutor getThreadPoolExecutor(String identity)
ThreadPoolExecutor by it's identityidentity - the unique identityThreadPoolExecutorpublic ThreadPoolMonitorWrapper getThreadPoolMonitorWrapper(String identity)
ThreadPoolMonitorWrapper by it's identityidentity - the unique identityThreadPoolMonitorWrapperpublic void startMonitorThreadPool(String identity)
ThreadPoolExecutor registered in the governoridentity - the unique identitypublic void stopMonitorThreadPool(String identity)
ThreadPoolExecutor registered in the governoridentity - the unique identitypublic void restartMonitorThreadPool(String identity)
ThreadPoolExecutor registered in the governoridentity - the unique identitypublic ScheduledExecutorService getMonitorScheduler()
ScheduledExecutorServicepublic int getSpaceNameThreadPoolNumber(String spaceName)
spaceName - the spaceNamepublic void startMonitorThreadPoolBySpaceName(String spaceName)
spaceName - the spaceNamepublic void stopMonitorThreadPoolBySpaceName(String spaceName)
spaceName - the spaceNamepublic void setMonitorThreadPoolBySpaceName(String spaceName, long period)
spaceName - the spaceNameCopyright © 2024. All rights reserved.