mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
opt threadPool name
This commit is contained in:
parent
1843dc8a60
commit
05206cd43d
@ -18,27 +18,27 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
@Configuration
|
||||
public class ThreadPoolConfig {
|
||||
|
||||
@Bean("timingTaskExecutor")
|
||||
@Bean("omsTimingPool")
|
||||
public Executor getTimingPool() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors());
|
||||
executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors());
|
||||
executor.setQueueCapacity(1024);
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("timingTaskExecutor-");
|
||||
executor.setThreadNamePrefix("omsTimingPool-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
@Bean("commonTaskExecutor")
|
||||
@Bean("omsCommonPool")
|
||||
public Executor taskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors());
|
||||
executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors());
|
||||
executor.setQueueCapacity(1024);
|
||||
executor.setKeepAliveSeconds(60);
|
||||
executor.setThreadNamePrefix("commonTaskExecutor-");
|
||||
executor.setThreadNamePrefix("omsCommonPool-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class LocalJpaConfig {
|
||||
jpaProperties.setShowSql(false);
|
||||
|
||||
HibernateProperties hibernateProperties = new HibernateProperties();
|
||||
// 考虑要不要用 create 模式,每次启动都删除数据
|
||||
// 每次启动都删除数据(重启后原来的Instance已经通过故障转移更换了Server,老的日志数据也没什么意义了)
|
||||
hibernateProperties.setDdlAuto("create");
|
||||
return hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(), new HibernateSettings());
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class InstanceLogService {
|
||||
* @param instanceId 任务实例ID
|
||||
*/
|
||||
@Transactional
|
||||
@Async("commonTaskExecutor")
|
||||
@Async("omsCommonPool")
|
||||
public void sync(Long instanceId) {
|
||||
|
||||
// 休眠10秒等待全部数据上报(OmsLogHandler 每隔5秒上报数据)
|
||||
@ -205,7 +205,7 @@ public class InstanceLogService {
|
||||
}
|
||||
}
|
||||
|
||||
@Async("timingTaskExecutor")
|
||||
@Async("omsTimingPool")
|
||||
@Scheduled(fixedDelay = 60000)
|
||||
public void timingCheck() {
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class InstanceStatusCheckService {
|
||||
@Resource
|
||||
private JobInfoRepository jobInfoRepository;
|
||||
|
||||
@Async("timingTaskExecutor")
|
||||
@Async("omsTimingPool")
|
||||
@Scheduled(fixedRate = 10000)
|
||||
public void timingStatusCheck() {
|
||||
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||
|
@ -63,7 +63,7 @@ public class JobScheduleService {
|
||||
|
||||
private static final long SCHEDULE_RATE = 15000;
|
||||
|
||||
@Async("timingTaskExecutor")
|
||||
@Async("omsTimingPool")
|
||||
@Scheduled(fixedRate = SCHEDULE_RATE)
|
||||
public void timingSchedule() {
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class InstanceController {
|
||||
|
||||
String targetServer = appInfoOpt.get().getCurrentServer();
|
||||
|
||||
// 转发HTTP请求
|
||||
// 转发HTTP请求(如果使用Akka,则需要传输两次,而转发HTTP请求只需要传输一次"大"数据包)
|
||||
if (!OhMyServer.getActorSystemAddress().equals(targetServer)) {
|
||||
String ip = targetServer.split(":")[0];
|
||||
String url = "http://" + ip + ":" + port + "/instance/log?instanceId=" + instanceId;
|
||||
|
@ -14,4 +14,4 @@ spring.data.mongodb.uri=mongodb://remotehost:27017/oms
|
||||
|
||||
####### jpa config #######
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.data.mongodb.repositories.type=none
|
@ -35,7 +35,7 @@ public class StandaloneProcessorDemo implements BasicProcessor {
|
||||
try {
|
||||
Collections.emptyList().add("277");
|
||||
}catch (Exception e) {
|
||||
context.getOmsLogger().error("[StandaloneProcessorDemo] process failed.", e);
|
||||
context.getOmsLogger().error("[StandaloneProcessorDemo] test exception log.", e);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user