use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.
the class GroupPriorityQueue method build.
/**
* 每个GroupPriorityQueue中增加独立线程,以定时调度方式从数据库中获取任务。(数据库查询以id和优先级为条件)
*/
public GroupPriorityQueue build() {
this.environmentContext = applicationContext.getBean(EnvironmentContext.class);
this.engineJobCacheService = applicationContext.getBean(EngineJobCacheService.class);
this.jobPartitioner = applicationContext.getBean(JobPartitioner.class);
this.workerOperator = applicationContext.getBean(WorkerOperator.class);
this.queueSizeLimited = environmentContext.getQueueSize();
checkParams();
this.queue = new PriorityBlockingQueue<>(queueSizeLimited * 2, new JobClientComparator());
this.jobSubmitDealer = new JobSubmitDealer(environmentContext.getLocalAddress(), this, applicationContext);
ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory(this.getClass().getSimpleName() + "_" + jobResource + "_AcquireJob"));
scheduledService.scheduleWithFixedDelay(new AcquireGroupQueueJob(), WAIT_INTERVAL * 10L, WAIT_INTERVAL, TimeUnit.MILLISECONDS);
ExecutorService jobSubmitService = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), new CustomThreadFactory(this.getClass().getSimpleName() + "_" + jobResource + "_JobSubmit"));
jobSubmitService.submit(jobSubmitDealer);
return this;
}
use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.
the class AbstractJobScanningScheduler method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
LOGGER.info("Initializing scheduleType:{} acquireQueueJobInterval:{} queueSize:{}", getSchedulerName(), env.getAcquireQueueJobInterval(), env.getQueueSize());
ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory(getSchedulerName() + "_AcquireJob"));
scheduledService.scheduleWithFixedDelay(this::scanningJob, 0, env.getAcquireQueueJobInterval(), TimeUnit.MILLISECONDS);
}
use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.
the class JobDealer method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
LOGGER.info("Initializing " + this.getClass().getName());
SystemPropertyUtil.setHadoopUserName(environmentContext.getHadoopUserName());
executors.execute(jobSubmittedDealer);
ExecutorService recoverExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new CustomThreadFactory(this.getClass().getSimpleName()));
recoverExecutor.submit(new RecoverDealer());
}
use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.
the class JobGraphBuilderTrigger method startJobGraph.
private void startJobGraph() {
if (RUNNING.get()) {
return;
}
if (scheduledService.isShutdown()) {
scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory("JobGraphTrigger"));
}
scheduledService.scheduleAtFixedRate(this, 100, CHECK_JOB_BUILD_INTERVAL, TimeUnit.MILLISECONDS);
RUNNING.compareAndSet(false, true);
LOGGER.info("start job graph trigger...");
}
use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.
the class FillDataThreadPoolExecutor method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
// 线程池维护线程的最少数量
executor.setCorePoolSize(environmentContext.getFillDataThreadPoolCorePoolSize());
// 线程池维护线程的最大数量
executor.setMaxPoolSize(environmentContext.getMaxFillDataThreadPoolSize());
// 线程池所使用的缓冲队列
executor.setQueueCapacity(environmentContext.getFillDataQueueCapacity());
// 设置线程工程类
executor.setThreadFactory(new CustomThreadFactory(this.getClass().getSimpleName()));
executor.initialize();
}
Aggregations