Merge pull request #479 from mabaiwan/develop

hippo4j-core-spring-boot-starter code naming and log optimization
pull/483/head
小马哥 2 years ago committed by GitHub
commit c8e2243a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,10 @@
package cn.hippo4j.common.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
@ -26,6 +29,9 @@ import java.io.Serializable;
* Thread pool parameter info.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class ThreadPoolParameterInfo implements ThreadPoolParameter, Serializable {

@ -18,12 +18,18 @@
package cn.hippo4j.message.request;
import cn.hippo4j.message.request.base.BaseNotifyRequest;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Change parameter notify request.
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChangeParameterNotifyRequest extends BaseNotifyRequest {
private String active;

@ -19,9 +19,6 @@ package cn.hippo4j.core.springboot.starter.common;
/**
* Config file type enum.
*
* @author chen.ma
* @date 2022/2/26 18:12
*/
public enum ConfigFileTypeEnum {

@ -27,10 +27,7 @@ import java.util.List;
import java.util.Map;
/**
* Bootstrap properties.
*
* @author chen.ma
* @date 2022/2/25 00:35
* Bootstrap core properties.
*/
@Getter
@Setter

@ -48,7 +48,7 @@ import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
/**
* Dynamic thread-pool core auto-configuration.
* Dynamic thread-pool core auto configuration.
*/
@Configuration
@AllArgsConstructor

@ -27,61 +27,58 @@ import java.util.Objects;
/**
* Executor properties.
*
* @author chen.ma
* @date 2022/2/25 00:40
*/
@Data
@Accessors(chain = true)
public class ExecutorProperties {
/**
* threadPoolId
* Thread pool id
*/
private String threadPoolId;
/**
* corePoolSize
* Core pool size
*/
private Integer corePoolSize;
/**
* maximumPoolSize
* Maximum pool size
*/
private Integer maximumPoolSize;
/**
* queueCapacity
* Queue capacity
*/
private Integer queueCapacity;
/**
* blockingQueue
* Blocking queue
*/
private String blockingQueue;
/**
* rejectedHandler
* Rejected handler
*/
private String rejectedHandler;
/**
* keepAliveTime
* Keep alive time
*/
private Long keepAliveTime;
/**
* executeTimeOut
* Execute timeout
*/
private Long executeTimeOut;
/**
* allowCoreThreadTimeOut
* Allow core thread timeout
*/
private Boolean allowCoreThreadTimeOut;
/**
* threadNamePrefix
* Thread name prefix
*/
private String threadNamePrefix;

@ -21,32 +21,28 @@ import lombok.Data;
/**
* Notify platform properties.
*
* @author chen.ma
* @date 2022/2/25 19:29
*/
@Data
public class NotifyPlatformProperties {
/**
* Platform.
* Platform
*/
private String platform;
/**
* Secret key.
* {@link NotifyPlatformProperties#token}
* Secret key. {@link NotifyPlatformProperties#token}
*/
@Deprecated
private String secretKey;
/**
* Token.
* Token
*/
private String token;
/**
* Secret.
* Secret
*/
private String secret;
}

@ -21,9 +21,6 @@ import lombok.Data;
/**
* Web thread pool properties.
*
* @author chen.ma
* @date 2022/3/11 19:23
*/
@Data
public class WebThreadPoolProperties {

@ -38,9 +38,6 @@ import java.util.concurrent.TimeUnit;
/**
* Dynamic thread-pool monitor executor.
*
* @author chen.ma
* @date 2022/3/25 19:29
*/
@Slf4j
@RequiredArgsConstructor
@ -87,7 +84,7 @@ public class DynamicThreadPoolMonitorExecutor implements ApplicationRunner {
try {
each.collect();
} catch (Exception ex) {
log.error("Error monitoring the running status of dynamic thread pool. Type :: {}", each.getType(), ex);
log.error("Error monitoring the running status of dynamic thread pool. Type: {}", each.getType(), ex);
}
}
}

@ -38,9 +38,6 @@ import java.util.stream.Collectors;
/**
* Core notify config builder.
*
* @author chen.ma
* @date 2022/2/25 00:24
*/
@AllArgsConstructor
@Slf4j
@ -139,7 +136,6 @@ public class CoreNotifyConfigBuilder implements NotifyConfigBuilder {
receive = receives.get(platformProperties.getPlatform());
}
}
return receive;
}

@ -18,9 +18,7 @@
package cn.hippo4j.core.springboot.starter.parser;
/**
* @author : wh
* @date : 2022/3/1 07:50
* @description:
* Abstract config parser
*/
public abstract class AbstractConfigParser implements ConfigParser {

@ -20,40 +20,38 @@ package cn.hippo4j.core.springboot.starter.parser;
import lombok.Getter;
/**
* @author : wh
* @date : 2022/3/1 07:47
* @description:
* Config file type enum
*/
@Getter
public enum ConfigFileTypeEnum {
/**
* properties
* PROPERTIES
*/
PROPERTIES("properties"),
/**
* xml
* XML
*/
XML("xml"),
/**
* json
* JSON
*/
JSON("json"),
/**
* yml
* YML
*/
YML("yml"),
/**
* yaml
* YAML
*/
YAML("yaml"),
/**
* txt
* TXT
*/
TXT("txt");
@ -71,5 +69,4 @@ public enum ConfigFileTypeEnum {
}
return PROPERTIES;
}
}

@ -22,9 +22,7 @@ import java.util.List;
import java.util.Map;
/**
* @author : wh
* @date : 2022/3/1 07:47
* @description:
* Config parser.
*/
public interface ConfigParser {

@ -26,9 +26,7 @@ import java.util.Map;
import java.util.ServiceLoader;
/**
* @author : wh
* @date : 2022/3/1 08:02
* @description:
* Config parser handler.
*/
public class ConfigParserHandler {
@ -39,7 +37,6 @@ public class ConfigParserHandler {
for (ConfigParser configParser : loader) {
PARSERS.add(configParser);
}
PARSERS.add(new PropertiesConfigParser());
PARSERS.add(new YamlConfigParser());
}
@ -50,7 +47,6 @@ public class ConfigParserHandler {
return parser.doParse(content);
}
}
return Collections.emptyMap();
}

@ -26,9 +26,7 @@ import java.util.Map;
import java.util.Properties;
/**
* @author : wh
* @date : 2022/3/1 07:49
* @description:
* Properties config parser.
*/
public class PropertiesConfigParser extends AbstractConfigParser {

@ -27,9 +27,7 @@ import java.util.List;
import java.util.Map;
/**
* @author : wh
* @date : 2022/3/1 07:57
* @description:
* Yaml config parser.
*/
public class YamlConfigParser extends AbstractConfigParser {
@ -38,11 +36,9 @@ public class YamlConfigParser extends AbstractConfigParser {
if (StringUtils.isEmpty(content)) {
return Maps.newHashMapWithExpectedSize(0);
}
YamlPropertiesFactoryBean bean = new YamlPropertiesFactoryBean();
bean.setResources(new ByteArrayResource(content.getBytes()));
return bean.getObject();
YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean();
yamlPropertiesFactoryBean.setResources(new ByteArrayResource(content.getBytes()));
return yamlPropertiesFactoryBean.getObject();
}
@Override

@ -34,9 +34,6 @@ import java.util.concurrent.ExecutorService;
/**
* Abstract core thread-pool dynamic refresh.
*
* @author chen.ma
* @date 2022/2/26 12:42
*/
@Slf4j
@RequiredArgsConstructor

@ -32,9 +32,7 @@ import java.util.Map;
import static cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties.PREFIX;
/**
* @author : wh
* @date : 2022/2/28 21:32
* @description:
* Apollo refresher handler.
*/
@Slf4j
public class ApolloRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh {
@ -62,6 +60,6 @@ public class ApolloRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh
dynamicRefresh(configFile.getContent(), newChangeValueMap);
};
config.addChangeListener(configChangeListener);
log.info("dynamic-thread-pool refresher, add apollo listener success, namespace: {}", namespace);
log.info("Dynamic thread pool refresher, add apollo listener success. namespace: {}", namespace);
}
}

@ -40,9 +40,6 @@ import static cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties.
/**
* Bootstrap core properties binder adapt.
*
* @author chen.ma
* @date 2022/3/9 19:04
*/
public class BootstrapCorePropertiesBinderAdapt {

@ -27,9 +27,6 @@ import java.util.concurrent.Executor;
/**
* Nacos cloud refresher handler.
*
* @author chen.ma
* @date 2022/2/26 11:21
*/
@Slf4j
public class NacosCloudRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh {
@ -56,5 +53,6 @@ public class NacosCloudRefresherHandler extends AbstractCoreThreadPoolDynamicRef
dynamicRefresh(configInfo);
}
});
log.info("Dynamic thread pool refresher, add nacos cloud listener success. data-id: {}, group: {}", nacosConfig.get("data-id"), nacosConfig.get("group"));
}
}

@ -28,9 +28,6 @@ import java.util.concurrent.Executor;
/**
* Nacos refresher handler.
*
* @author chen.ma
* @date 2022/2/26 00:10
*/
@Slf4j
public class NacosRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh {
@ -59,5 +56,7 @@ public class NacosRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh
dynamicRefresh(configInfo);
}
});
log.info("Dynamic thread pool refresher, add nacos listener success. data-id: {}, group: {}", nacosConfig.get("data-id"), nacosConfig.get("group"));
}
}

@ -36,8 +36,7 @@ import java.util.List;
import java.util.Map;
/**
* @author Redick01
* @date 2022/3/14 16:03
* Zookeeper refresher handler.
*/
@Slf4j
public class ZookeeperRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh {
@ -93,15 +92,15 @@ public class ZookeeperRefresherHandler extends AbstractCoreThreadPoolDynamicRefr
String value = "";
try {
value = new String(data.watched().forPath(n), Charsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
} catch (Exception ex) {
log.error("Load zookeeper node error", ex);
}
content.append(nodeName).append("=").append(value).append("\n");
});
dynamicRefresh(content.toString());
registerNotifyAlarmManage();
} catch (Exception e) {
log.error("load zk node error, nodePath is {}", nodePath, e);
} catch (Exception ex) {
log.error("Load zookeeper node error, nodePath is: {}", nodePath, ex);
}
}

@ -98,37 +98,38 @@ public class ExecutorsListener implements ApplicationListener<Hippo4jCoreDynamic
try {
threadPoolNotifyAlarmHandler.sendPoolConfigChange(newChangeRequest(beforeProperties, properties));
} catch (Throwable ex) {
log.error("Failed to send changSmartApplicationListenere notice. Message :: {}", ex.getMessage());
log.error("Failed to send Chang smart application listener notice. Message: {}", ex.getMessage());
}
}
}
/**
* Construct ChangeParameterNotifyRequest instance
* Construct change parameter notify request instance.
*
* @param beforeProperties old properties
* @param properties new properties
* @return instance
*/
private ChangeParameterNotifyRequest newChangeRequest(ExecutorProperties beforeProperties, ExecutorProperties properties) {
ChangeParameterNotifyRequest changeRequest = new ChangeParameterNotifyRequest();
changeRequest.setBeforeCorePoolSize(beforeProperties.getCorePoolSize());
changeRequest.setBeforeMaximumPoolSize(beforeProperties.getMaximumPoolSize());
changeRequest.setBeforeAllowsCoreThreadTimeOut(beforeProperties.getAllowCoreThreadTimeOut());
changeRequest.setBeforeKeepAliveTime(beforeProperties.getKeepAliveTime());
changeRequest.setBlockingQueueName(beforeProperties.getBlockingQueue());
changeRequest.setBeforeQueueCapacity(beforeProperties.getQueueCapacity());
changeRequest.setBeforeRejectedName(beforeProperties.getRejectedHandler());
changeRequest.setBeforeExecuteTimeOut(beforeProperties.getExecuteTimeOut());
changeRequest.setThreadPoolId(beforeProperties.getThreadPoolId());
changeRequest.setNowCorePoolSize(properties.getCorePoolSize());
changeRequest.setNowMaximumPoolSize(properties.getMaximumPoolSize());
changeRequest.setNowAllowsCoreThreadTimeOut(properties.getAllowCoreThreadTimeOut());
changeRequest.setNowKeepAliveTime(properties.getKeepAliveTime());
changeRequest.setNowQueueCapacity(properties.getQueueCapacity());
changeRequest.setNowRejectedName(properties.getRejectedHandler());
changeRequest.setNowExecuteTimeOut(properties.getExecuteTimeOut());
return changeRequest;
ChangeParameterNotifyRequest changeParameterNotifyRequest = ChangeParameterNotifyRequest.builder()
.beforeCorePoolSize(beforeProperties.getCorePoolSize())
.beforeMaximumPoolSize(beforeProperties.getMaximumPoolSize())
.beforeAllowsCoreThreadTimeOut(beforeProperties.getAllowCoreThreadTimeOut())
.beforeKeepAliveTime(beforeProperties.getKeepAliveTime())
.blockingQueueName(beforeProperties.getBlockingQueue())
.beforeQueueCapacity(beforeProperties.getQueueCapacity())
.beforeRejectedName(beforeProperties.getRejectedHandler())
.beforeExecuteTimeOut(beforeProperties.getExecuteTimeOut())
.nowCorePoolSize(properties.getCorePoolSize())
.nowMaximumPoolSize(properties.getMaximumPoolSize())
.nowAllowsCoreThreadTimeOut(properties.getAllowCoreThreadTimeOut())
.nowKeepAliveTime(properties.getKeepAliveTime())
.nowQueueCapacity(properties.getQueueCapacity())
.nowRejectedName(properties.getRejectedHandler())
.nowExecuteTimeOut(properties.getExecuteTimeOut())
.build();
changeParameterNotifyRequest.setThreadPoolId(beforeProperties.getThreadPoolId());
return changeParameterNotifyRequest;
}
/**
@ -257,7 +258,7 @@ public class ExecutorsListener implements ApplicationListener<Hippo4jCoreDynamic
ResizableCapacityLinkedBlockingQueue<?> queue = (ResizableCapacityLinkedBlockingQueue<?>) executor.getQueue();
queue.setCapacity(properties.getQueueCapacity());
} else {
log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName());
log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type: {}", executor.getQueue().getClass().getSimpleName());
}
}
}

@ -23,7 +23,7 @@ import lombok.Setter;
import org.springframework.context.ApplicationEvent;
/**
* Hippo4j core dynamic refresh event.
* Hippo-4j core dynamic refresh event.
*/
public class Hippo4jCoreDynamicRefreshEvent extends ApplicationEvent {

@ -18,7 +18,7 @@
package cn.hippo4j.core.springboot.starter.refresher.event;
/**
* Hippo4j core dynamic refresh event order.
* Hippo-4j core dynamic refresh event order.
*/
public interface Hippo4jCoreDynamicRefreshEventOrder {

@ -43,13 +43,13 @@ public class PlatformsListener implements ApplicationListener<Hippo4jCoreDynamic
public void onApplicationEvent(Hippo4jCoreDynamicRefreshEvent threadPoolDynamicRefreshEvent) {
BootstrapCoreProperties bindableCoreProperties = threadPoolDynamicRefreshEvent.getBootstrapCoreProperties();
List<ExecutorProperties> executors = bindableCoreProperties.getExecutors();
for (ExecutorProperties executor : executors) {
String threadPoolId = executor.getThreadPoolId();
for (ExecutorProperties executorProperties : executors) {
String threadPoolId = executorProperties.getThreadPoolId();
DynamicThreadPoolWrapper wrapper = GlobalThreadPoolManage.getExecutorService(threadPoolId);
if (wrapper != null && !wrapper.isInitFlag()) {
Hippo4jBaseSendMessageService sendMessageService = ApplicationContextHolder.getBean(Hippo4jBaseSendMessageService.class);
CoreNotifyConfigBuilder configBuilder = ApplicationContextHolder.getBean(CoreNotifyConfigBuilder.class);
Map<String, List<NotifyConfigDTO>> notifyConfig = configBuilder.buildSingleNotifyConfig(executor);
Map<String, List<NotifyConfigDTO>> notifyConfig = configBuilder.buildSingleNotifyConfig(executorProperties);
sendMessageService.putPlatform(notifyConfig);
wrapper.setInitFlag(Boolean.TRUE);
}

@ -63,25 +63,25 @@ public class WebExecutorListener implements ApplicationListener<Hippo4jCoreDynam
} catch (Exception ex) {
log.error("Failed to modify web thread pool.", ex);
}
}
private ThreadPoolParameterInfo buildWebPoolParameter(BootstrapCoreProperties bindableCoreProperties) {
ThreadPoolParameterInfo parameterInfo = null;
WebThreadPoolProperties poolProperties = null;
ThreadPoolParameterInfo threadPoolParameterInfo = null;
WebThreadPoolProperties webThreadPoolProperties = null;
if (bindableCoreProperties.getTomcat() != null) {
poolProperties = bindableCoreProperties.getTomcat();
webThreadPoolProperties = bindableCoreProperties.getTomcat();
} else if (bindableCoreProperties.getUndertow() != null) {
poolProperties = bindableCoreProperties.getUndertow();
webThreadPoolProperties = bindableCoreProperties.getUndertow();
} else if (bindableCoreProperties.getJetty() != null) {
poolProperties = bindableCoreProperties.getJetty();
webThreadPoolProperties = bindableCoreProperties.getJetty();
}
if (poolProperties != null) {
parameterInfo = new ThreadPoolParameterInfo();
parameterInfo.setCoreSize(poolProperties.getCorePoolSize());
parameterInfo.setMaxSize(poolProperties.getMaximumPoolSize());
parameterInfo.setKeepAliveTime(poolProperties.getKeepAliveTime());
if (webThreadPoolProperties != null) {
threadPoolParameterInfo = ThreadPoolParameterInfo.builder()
.coreSize(webThreadPoolProperties.getCorePoolSize())
.maximumPoolSize(webThreadPoolProperties.getMaximumPoolSize())
.keepAliveTime(webThreadPoolProperties.getKeepAliveTime())
.build();
}
return parameterInfo;
return threadPoolParameterInfo;
}
}

@ -43,9 +43,6 @@ import java.util.concurrent.TimeUnit;
/**
* Dynamic thread-pool post processor.
*
* @author chen.ma
* @date 2021/8/2 20:40
*/
@Slf4j
@AllArgsConstructor
@ -99,11 +96,11 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
/**
* Fill the thread pool and register.
*
* @param dynamicThreadPoolWrap
* @param dynamicThreadPoolWrapper
*/
protected ThreadPoolExecutor fillPoolAndRegister(DynamicThreadPoolWrapper dynamicThreadPoolWrap) {
String threadPoolId = dynamicThreadPoolWrap.getThreadPoolId();
ThreadPoolExecutor newDynamicPoolExecutor = dynamicThreadPoolWrap.getExecutor();
protected ThreadPoolExecutor fillPoolAndRegister(DynamicThreadPoolWrapper dynamicThreadPoolWrapper) {
String threadPoolId = dynamicThreadPoolWrapper.getThreadPoolId();
ThreadPoolExecutor newDynamicPoolExecutor = dynamicThreadPoolWrapper.getExecutor();
ExecutorProperties executorProperties = null;
if (null != bootstrapCoreProperties.getExecutors()) {
executorProperties = bootstrapCoreProperties.getExecutors()
@ -126,16 +123,15 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
.allowCoreThreadTimeOut(executorProperties.getAllowCoreThreadTimeOut())
.build();
} catch (Exception ex) {
log.error("Failed to initialize thread pool configuration. error :: {}", ex);
log.error("Failed to initialize thread pool configuration. error: {}", ex);
} finally {
if (Objects.isNull(dynamicThreadPoolWrap.getExecutor())) {
dynamicThreadPoolWrap.setExecutor(CommonDynamicThreadPool.getInstance(threadPoolId));
if (Objects.isNull(dynamicThreadPoolWrapper.getExecutor())) {
dynamicThreadPoolWrapper.setExecutor(CommonDynamicThreadPool.getInstance(threadPoolId));
}
dynamicThreadPoolWrap.setInitFlag(Boolean.TRUE);
dynamicThreadPoolWrapper.setInitFlag(Boolean.TRUE);
}
}
if (dynamicThreadPoolWrap.getExecutor() instanceof AbstractDynamicExecutorSupport) {
if (dynamicThreadPoolWrapper.getExecutor() instanceof AbstractDynamicExecutorSupport) {
ThreadPoolNotifyAlarm notify = Optional.ofNullable(executorProperties).map(ExecutorProperties::getNotify).orElse(null);
boolean isAlarm = Optional.ofNullable(notify)
.map(each -> each.getIsAlarm()).orElseGet(() -> bootstrapCoreProperties.getAlarm() != null ? bootstrapCoreProperties.getAlarm() : true);
@ -151,18 +147,15 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
threadPoolNotifyAlarm.setInterval(interval);
threadPoolNotifyAlarm.setReceive(receive);
GlobalNotifyAlarmManage.put(threadPoolId, threadPoolNotifyAlarm);
TaskDecorator taskDecorator = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrap.getExecutor()).getTaskDecorator();
TaskDecorator taskDecorator = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrapper.getExecutor()).getTaskDecorator();
((DynamicThreadPoolExecutor) newDynamicPoolExecutor).setTaskDecorator(taskDecorator);
long awaitTerminationMillis = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrap.getExecutor()).awaitTerminationMillis;
boolean waitForTasksToCompleteOnShutdown = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrap.getExecutor()).waitForTasksToCompleteOnShutdown;
long awaitTerminationMillis = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrapper.getExecutor()).awaitTerminationMillis;
boolean waitForTasksToCompleteOnShutdown = ((DynamicThreadPoolExecutor) dynamicThreadPoolWrapper.getExecutor()).waitForTasksToCompleteOnShutdown;
((DynamicThreadPoolExecutor) newDynamicPoolExecutor).setSupportParam(awaitTerminationMillis, waitForTasksToCompleteOnShutdown);
}
dynamicThreadPoolWrap.setExecutor(newDynamicPoolExecutor);
dynamicThreadPoolWrapper.setExecutor(newDynamicPoolExecutor);
}
GlobalThreadPoolManage.registerPool(dynamicThreadPoolWrap.getThreadPoolId(), dynamicThreadPoolWrap);
GlobalThreadPoolManage.registerPool(dynamicThreadPoolWrapper.getThreadPoolId(), dynamicThreadPoolWrapper);
GlobalCoreThreadPoolManage.register(
threadPoolId,
executorProperties == null
@ -180,10 +173,10 @@ public final class DynamicThreadPoolPostProcessor implements BeanPostProcessor {
*/
private ExecutorProperties buildExecutorProperties(String threadPoolId, ThreadPoolExecutor executor) {
ExecutorProperties executorProperties = new ExecutorProperties();
BlockingQueue<Runnable> queue = executor.getQueue();
int queueSize = queue.size();
String queueType = queue.getClass().getSimpleName();
int remainingCapacity = queue.remainingCapacity();
BlockingQueue<Runnable> blockingQueue = executor.getQueue();
int queueSize = blockingQueue.size();
String queueType = blockingQueue.getClass().getSimpleName();
int remainingCapacity = blockingQueue.remainingCapacity();
int queueCapacity = queueSize + remainingCapacity;
executorProperties.setCorePoolSize(executor.getCorePoolSize())
.setMaximumPoolSize(executor.getMaximumPoolSize())

@ -24,9 +24,6 @@ import java.util.Map;
/**
* Global core thread-pool manage.
*
* @author chen.ma
* @date 2022/2/26 19:47
*/
public class GlobalCoreThreadPoolManage {

Loading…
Cancel
Save