reports-service: http://jira.mfd.msk:8088/browse/CLS-711 (fix init)
This commit is contained in:
parent
a99104d8dd
commit
6e7fce1fe2
1 changed files with 22 additions and 6 deletions
|
|
@ -14,6 +14,26 @@ import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
|||
|
||||
@Configuration
|
||||
public class ClearingImdgConfig {
|
||||
private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) {
|
||||
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
|
||||
if (maxPoolSz > 2) {
|
||||
pool.setKeepAliveSeconds(60);
|
||||
pool.setAllowCoreThreadTimeOut(true);
|
||||
}
|
||||
pool.setCorePoolSize(maxPoolSz);
|
||||
pool.setWaitForTasksToCompleteOnShutdown(waitForCompletion);
|
||||
pool.initialize();
|
||||
return pool;
|
||||
}
|
||||
|
||||
public ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer() {
|
||||
return createThreadPoolTaskExecutor(1, true);
|
||||
}
|
||||
|
||||
public ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter() {
|
||||
return createThreadPoolTaskExecutor(1, false);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ImdgProvider imdgProvider(ReportsServiceSettings settings, Environment env) throws PropertyVetoException {
|
||||
String[] activeProfiles = env.getActiveProfiles();
|
||||
|
|
@ -25,12 +45,8 @@ public class ClearingImdgConfig {
|
|||
}
|
||||
}
|
||||
if (!isDevProfile) {
|
||||
ThreadPoolTaskExecutor hazelcastClientInitializerPool = new ThreadPoolTaskExecutor();
|
||||
hazelcastClientInitializerPool.setCorePoolSize(1);
|
||||
hazelcastClientInitializerPool.setWaitForTasksToCompleteOnShutdown(true);
|
||||
ThreadPoolTaskExecutor idGeneratorAwaiterPool = new ThreadPoolTaskExecutor();
|
||||
idGeneratorAwaiterPool.setCorePoolSize(1);
|
||||
idGeneratorAwaiterPool.setWaitForTasksToCompleteOnShutdown(false);
|
||||
ThreadPoolTaskExecutor hazelcastClientInitializerPool = taskExecutorHazelcastClientInitializer();
|
||||
ThreadPoolTaskExecutor idGeneratorAwaiterPool = taskExecutorIdGeneratorAwaiter();
|
||||
return new HazelcastService(hazelcastClientInitializerPool, idGeneratorAwaiterPool, settings.getHazelcast());
|
||||
} else {
|
||||
ComboPooledDataSource dataSource = new ComboPooledDataSource();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue