|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
package cn.hippo4j.starter.wrapper;
|
|
|
|
|
|
|
|
|
|
import cn.hippo4j.starter.common.CommonDynamicThreadPool;
|
|
|
|
|
import cn.hippo4j.starter.core.DynamicThreadPoolExecutor;
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Dynamic threadPool wrapper.
|
|
|
|
@ -24,7 +24,7 @@ public class DynamicThreadPoolWrapper {
|
|
|
|
|
|
|
|
|
|
private boolean subscribeFlag;
|
|
|
|
|
|
|
|
|
|
private DynamicThreadPoolExecutor pool;
|
|
|
|
|
private ThreadPoolExecutor executor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 首选服务端线程池, 为空使用默认线程池 {@link CommonDynamicThreadPool#getInstance(String)}
|
|
|
|
@ -41,9 +41,9 @@ public class DynamicThreadPoolWrapper {
|
|
|
|
|
* @param threadPoolId
|
|
|
|
|
* @param threadPoolExecutor
|
|
|
|
|
*/
|
|
|
|
|
public DynamicThreadPoolWrapper(String threadPoolId, DynamicThreadPoolExecutor threadPoolExecutor) {
|
|
|
|
|
public DynamicThreadPoolWrapper(String threadPoolId, ThreadPoolExecutor threadPoolExecutor) {
|
|
|
|
|
this.tpId = threadPoolId;
|
|
|
|
|
this.pool = threadPoolExecutor;
|
|
|
|
|
this.executor = threadPoolExecutor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -52,7 +52,7 @@ public class DynamicThreadPoolWrapper {
|
|
|
|
|
* @param command
|
|
|
|
|
*/
|
|
|
|
|
public void execute(Runnable command) {
|
|
|
|
|
pool.execute(command);
|
|
|
|
|
executor.execute(command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -62,7 +62,7 @@ public class DynamicThreadPoolWrapper {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Future<?> submit(Runnable task) {
|
|
|
|
|
return pool.submit(task);
|
|
|
|
|
return executor.submit(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -73,7 +73,7 @@ public class DynamicThreadPoolWrapper {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public <T> Future<T> submit(Callable<T> task) {
|
|
|
|
|
return pool.submit(task);
|
|
|
|
|
return executor.submit(task);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|