Revert "Migrate CPS to Spring-boot 3.0"
[cps.git] / cps-service / src / main / java / org / onap / cps / config / AsyncConfig.java
index 2d8f7fb..9327c53 100644 (file)
@@ -21,6 +21,7 @@
 
 package org.onap.cps.config;
 
+import java.util.concurrent.ThreadPoolExecutor;
 import javax.validation.constraints.Min;
 import lombok.Setter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -61,7 +62,10 @@ public class AsyncConfig {
         executor.setMaxPoolSize(maxPoolSize);
         executor.setQueueCapacity(queueCapacity);
         executor.setWaitForTasksToCompleteOnShutdown(waitForTasksToCompleteOnShutdown);
+        executor.setKeepAliveSeconds(60);
         executor.setThreadNamePrefix(threadNamePrefix);
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
+        executor.initialize();
         return executor;
     }