- 调度线程池隔离,拆分为"Fast"和"Slow"两个线程池,1分钟窗口期内任务耗时达500ms超过10次,该窗口期内判定为慢任务,慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;master
parent
f83d03f78a
commit
8658f8d853
5 changed files with 139 additions and 18 deletions
@ -0,0 +1,58 @@ |
||||
package com.xxl.job.admin.core.quartz; |
||||
|
||||
import org.quartz.SchedulerConfigException; |
||||
import org.quartz.spi.ThreadPool; |
||||
|
||||
/** |
||||
* single thread pool, for async trigger |
||||
* |
||||
* @author xuxueli 2019-03-06 |
||||
*/ |
||||
public class XxlJobThreadPool implements ThreadPool { |
||||
|
||||
@Override |
||||
public boolean runInThread(Runnable runnable) { |
||||
|
||||
// async run
|
||||
runnable.run(); |
||||
return true; |
||||
|
||||
//return false;
|
||||
} |
||||
|
||||
@Override |
||||
public int blockForAvailableThreads() { |
||||
return 1; |
||||
} |
||||
|
||||
@Override |
||||
public void initialize() throws SchedulerConfigException { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void shutdown(boolean waitForJobsToComplete) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public int getPoolSize() { |
||||
return 1; |
||||
} |
||||
|
||||
@Override |
||||
public void setInstanceId(String schedInstId) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void setInstanceName(String schedName) { |
||||
|
||||
} |
||||
|
||||
// support
|
||||
public void setThreadCount(int count) { |
||||
//
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue