Search in sources :

Example 1 with CustomThreadFactory

use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.

the class TaskLogStoreDealer method init.

@PostConstruct
public void init() {
    dbConfig.put(ConfigConstant.JDBCURL, environmentContext.getJdbcUrl());
    dbConfig.put(ConfigConstant.USERNAME, environmentContext.getJdbcUser());
    dbConfig.put(ConfigConstant.PASSWORD, environmentContext.getJdbcPassword());
    dbConfig.put(ConfigConstant.INITIAL_SIZE, String.valueOf(environmentContext.getInitialPoolSize()));
    dbConfig.put(ConfigConstant.MINIDLE, String.valueOf(environmentContext.getMinPoolSize()));
    dbConfig.put(ConfigConstant.MAXACTIVE, String.valueOf(environmentContext.getMaxPoolSize()));
    logStore = LogStoreFactory.getLogStore(dbConfig);
    this.scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory(this.getClass().getSimpleName()));
    scheduledService.scheduleWithFixedDelay(this, 0, CHECK_INTERVAL, TimeUnit.MILLISECONDS);
}
Also used : CustomThreadFactory(com.dtstack.taier.pluginapi.CustomThreadFactory) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) PostConstruct(javax.annotation.PostConstruct)

Example 2 with CustomThreadFactory

use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.

the class JobSchedulerListener method onApplicationEvent.

@Override
public void onApplicationEvent(ApplicationStartedEvent applicationStartedEvent) {
    LOGGER.info("Initializing " + this.getClass().getName());
    if (!environmentContext.openJobSchedule()) {
        LOGGER.info("job schedule is not open!!!");
        return;
    }
    executors.add(fillDataJobScheduler);
    executors.add(cycleJobScheduler);
    executors.add(restartJobScheduler);
    executorService = new ThreadPoolExecutor(3, 3, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), new CustomThreadFactory("ExecutorDealer"));
    for (AbstractJobSummitScheduler scheduler : executors) {
        executorService.submit(scheduler);
    }
}
Also used : CustomThreadFactory(com.dtstack.taier.pluginapi.CustomThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) AbstractJobSummitScheduler(com.dtstack.taier.scheduler.server.scheduler.AbstractJobSummitScheduler)

Example 3 with CustomThreadFactory

use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.

the class JobStatusDealer method start.

public void start() {
    long jobStatusCheckInterVal = environmentContext.getJobStatusCheckInterVal();
    ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory(jobResource + this.getClass().getSimpleName()));
    scheduledService.scheduleWithFixedDelay(this, 0, jobStatusCheckInterVal, TimeUnit.MILLISECONDS);
    LOGGER.info("{} thread start ...", jobResource + this.getClass().getSimpleName());
}
Also used : CustomThreadFactory(com.dtstack.taier.pluginapi.CustomThreadFactory)

Example 4 with CustomThreadFactory

use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.

the class AbstractJobSummitScheduler method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();
    scheduleJobQueue = new LinkedBlockingQueue<>(env.getQueueSize());
    String threadName = this.getClass().getSimpleName() + "_" + getSchedulerName() + "_startJobProcessor";
    executorService = new ThreadPoolExecutor(env.getJobExecutorPoolCorePoolSize(), env.getJobExecutorPoolMaximumPoolSize(), env.getJobExecutorPoolKeepAliveTime(), TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(env.getJobExecutorPoolQueueSize()), new CustomThreadFactory(threadName), new CustomThreadRunsPolicy(threadName, getSchedulerName()));
}
Also used : CustomThreadFactory(com.dtstack.taier.pluginapi.CustomThreadFactory) CustomThreadRunsPolicy(com.dtstack.taier.common.CustomThreadRunsPolicy) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue)

Example 5 with CustomThreadFactory

use of com.dtstack.taier.pluginapi.CustomThreadFactory in project Taier by DTStack.

the class QueueListener method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    checkJobMaxPriorityStrategy = environmentContext.getCheckJobMaxPriorityStrategy();
    scheduledService = new ScheduledThreadPoolExecutor(1, new CustomThreadFactory(this.getClass().getSimpleName()));
    scheduledService.scheduleWithFixedDelay(this, 0, CHECK_INTERVAL, TimeUnit.MILLISECONDS);
}
Also used : CustomThreadFactory(com.dtstack.taier.pluginapi.CustomThreadFactory) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor)

Aggregations

CustomThreadFactory (com.dtstack.taier.pluginapi.CustomThreadFactory)12 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)5 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)4 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)3 CustomThreadRunsPolicy (com.dtstack.taier.common.CustomThreadRunsPolicy)1 EnvironmentContext (com.dtstack.taier.common.env.EnvironmentContext)1 JobClientComparator (com.dtstack.taier.common.queue.comparator.JobClientComparator)1 WorkerOperator (com.dtstack.taier.scheduler.WorkerOperator)1 JobSubmitDealer (com.dtstack.taier.scheduler.jobdealer.JobSubmitDealer)1 JobPartitioner (com.dtstack.taier.scheduler.server.JobPartitioner)1 AbstractJobSummitScheduler (com.dtstack.taier.scheduler.server.scheduler.AbstractJobSummitScheduler)1 EngineJobCacheService (com.dtstack.taier.scheduler.service.EngineJobCacheService)1 ExecutorService (java.util.concurrent.ExecutorService)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 PostConstruct (javax.annotation.PostConstruct)1