Merge branch 'master' into feature_rollouts_credentials
Conflicts: hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadStatusObject.java Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -23,7 +23,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
@ConditionalOnMissingBean(AsyncConfigurer.class)
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AsyncConfigurerThreadpoolProperties {
|
||||
/**
|
||||
* Max queue size for central event executor.
|
||||
*/
|
||||
private Integer queuesize = 250;
|
||||
private Integer queuesize = 5_000;
|
||||
|
||||
/**
|
||||
* Core processing threads for central event executor.
|
||||
@@ -30,7 +30,7 @@ public class AsyncConfigurerThreadpoolProperties {
|
||||
/**
|
||||
* Maximum thread pool size for central event executor.
|
||||
*/
|
||||
private Integer maxthreads = 50;
|
||||
private Integer maxthreads = 20;
|
||||
|
||||
/**
|
||||
* When the number of threads is greater than the core, this is the maximum
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.autoconfigure.scheduling;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -21,6 +22,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.security.concurrent.DelegatingSecurityContextExecutor;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
@@ -39,11 +43,21 @@ public class ExecutorAutoConfiguration {
|
||||
private AsyncConfigurerThreadpoolProperties asyncConfigurerProperties;
|
||||
|
||||
/**
|
||||
* @return ExecutorService for general purpose multi threaded operations
|
||||
* @return ExecutorService with security context availability in thread
|
||||
* execution..
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Executor asyncExecutor() {
|
||||
return new DelegatingSecurityContextExecutor(threadPoolExecutor());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return central ThreadPoolExecutor for general purpose multi threaded
|
||||
* operations. Tries an orderly shutdown when destroyed.
|
||||
*/
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public ThreadPoolExecutor threadPoolExecutor() {
|
||||
final BlockingQueue<Runnable> blockingQueue = new ArrayBlockingQueue<>(
|
||||
asyncConfigurerProperties.getQueuesize());
|
||||
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(asyncConfigurerProperties.getCorethreads(),
|
||||
@@ -53,7 +67,8 @@ public class ExecutorAutoConfiguration {
|
||||
threadPoolExecutor.setRejectedExecutionHandler((r, executor) -> LOGGER.warn(
|
||||
"Reject runnable for centralExecutorService, reached limit of queue size {}",
|
||||
executor.getQueue().size()));
|
||||
return new DelegatingSecurityContextExecutor(threadPoolExecutor);
|
||||
|
||||
return threadPoolExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,4 +84,32 @@ public class ExecutorAutoConfiguration {
|
||||
return new DelegatingSecurityContextExecutor(threadPoolExecutor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link TaskExecutor} for task execution
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public TaskExecutor taskExecutor() {
|
||||
return new ConcurrentTaskExecutor(asyncExecutor());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link ScheduledExecutorService} based on
|
||||
* {@link #threadPoolTaskScheduler()}.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ScheduledExecutorService scheduledExecutorService() {
|
||||
return threadPoolTaskScheduler().getScheduledExecutor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link ThreadPoolTaskScheduler} for scheduled operations.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
|
||||
return new ThreadPoolTaskScheduler();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user