mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
Bug 5214: Remove and replace DataMiningExceutorService with
ThreadPoolUtil background ThreadPoolExecutor
This commit is contained in:
+3
-2
@@ -5,12 +5,13 @@ import static org.junit.Assert.fail;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.DataMiningExecutorService;
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
public class ConcurrencyTestsUtil {
|
||||
|
||||
private static final int THREAD_POOL_SIZE = Math.max(Runtime.getRuntime().availableProcessors(), 3);
|
||||
private static final ExecutorService executor = new DataMiningExecutorService(THREAD_POOL_SIZE);
|
||||
private static final ExecutorService executor = ThreadPoolUtil.INSTANCE
|
||||
.createBackgroundTaskThreadPoolExecutor(THREAD_POOL_SIZE, ConcurrencyTestsUtil.class.getName());
|
||||
|
||||
public static ExecutorService getExecutor() {
|
||||
return executor;
|
||||
|
||||
+3
-1
@@ -45,6 +45,7 @@ import com.sap.sse.datamining.shared.data.QueryResultState;
|
||||
import com.sap.sse.datamining.shared.impl.GenericGroupKey;
|
||||
import com.sap.sse.datamining.test.util.components.StatefulBlockingInstruction;
|
||||
import com.sap.sse.datamining.test.util.components.StatefulProcessorInstruction;
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
/**
|
||||
* Integration test aborting a query with simulated heavy load instructions. Uses a highly customized processor chain
|
||||
@@ -250,7 +251,8 @@ public class TestAbortingHeavyLoadQuery {
|
||||
executionRecord = new ConcurrentLinkedQueue<>();
|
||||
}
|
||||
|
||||
executor = new DataMiningExecutorService(ExecutorPoolSize);
|
||||
executor = ThreadPoolUtil.INSTANCE
|
||||
.createBackgroundTaskThreadPoolExecutor(ExecutorPoolSize, this.getClass().getName());
|
||||
// executor = new ThreadPoolExecutor(ExecutorPoolSize, ExecutorPoolSize, 0, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<>());
|
||||
// executor = new ThreadPoolExecutor(ExecutorPoolSize, ExecutorPoolSize, 0, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>());
|
||||
processors = new ArrayList<>();
|
||||
|
||||
+4
-2
@@ -11,13 +11,15 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.DataMiningExecutorService;
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
import com.sap.sse.util.ThreadPoolUtil;
|
||||
|
||||
public class ConcurrencyTestsUtil extends TestsUtil {
|
||||
|
||||
private static final int THREAD_POOL_SIZE = Math.max(Runtime.getRuntime().availableProcessors(), 3);
|
||||
private static final ExecutorService executor = new DataMiningExecutorService(THREAD_POOL_SIZE);
|
||||
private static final ExecutorService executor = ThreadPoolUtil.INSTANCE
|
||||
.createBackgroundTaskThreadPoolExecutor(THREAD_POOL_SIZE, ConcurrencyTestsUtil.class.getName());
|
||||
|
||||
|
||||
public static ExecutorService getSharedExecutor() {
|
||||
return executor;
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.sap.sse.datamining.impl;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.sap.sse.util.impl.ThreadFactoryWithPriority;
|
||||
|
||||
public class DataMiningExecutorService extends ThreadPoolExecutor {
|
||||
public DataMiningExecutorService(int corePoolSize) {
|
||||
super(corePoolSize, corePoolSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(corePoolSize),
|
||||
new ThreadFactoryWithPriority(Thread.NORM_PRIORITY, /* daemon */ true),
|
||||
new RejectedExecutionHandler() {
|
||||
@Override
|
||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
||||
r.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -52,7 +52,6 @@ import com.sap.sse.util.ThreadPoolUtil;
|
||||
public class DataMiningFrameworkActivator implements BundleActivator {
|
||||
private static final Logger logger = Logger.getLogger(DataMiningFrameworkActivator.class.getName());
|
||||
private static final String STRING_MESSAGES_BASE_NAME = "stringmessages/StringMessages";
|
||||
private static final int THREAD_POOL_SIZE = ThreadPoolUtil.INSTANCE.getReasonableThreadPoolSize();
|
||||
|
||||
private static DataMiningFrameworkActivator INSTANCE;
|
||||
|
||||
@@ -70,7 +69,8 @@ public class DataMiningFrameworkActivator implements BundleActivator {
|
||||
}
|
||||
|
||||
private ModifiableDataMiningServer createDataMiningServer() {
|
||||
ExecutorService executor = new DataMiningExecutorService(THREAD_POOL_SIZE);
|
||||
ExecutorService executor = ThreadPoolUtil.INSTANCE
|
||||
.createBackgroundTaskThreadPoolExecutor(DataMiningServer.class.getName());
|
||||
FunctionRegistry functionRegistry = new FunctionManager();
|
||||
DataSourceProviderRegistry dataSourceProviderRegistry = new DataSourceProviderManager();
|
||||
DataRetrieverChainDefinitionRegistry dataRetrieverChainDefinitionRegistry = new DataRetrieverChainDefinitionManager();
|
||||
|
||||
Reference in New Issue
Block a user