hippo4j-adapter CheckStyle ERROR (#915)

* style:hippo4j-adapter CheckStyle ERROR

* style:hippo4j-adapter CheckStyle ERROR
pull/924/head
WuLang 2 years ago committed by GitHub
parent 429c2d0643
commit 59cb0b28c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,4 +25,6 @@
<suppress checks="StaticVariableName" files="ApplicationContextHolder.java"/>
<suppress checks="StaticVariableName" files="JacksonHandler.java"/>
<suppress checks="MagicNumber" files="ByteConvertUtil.java"/>
<suppress checks="MagicNumber" files="DubboThreadPoolAdapter.java"/>
<suppress checks="MagicNumber" files="UndertowWebThreadPoolHandler.java"/>
</suppressions>

@ -17,7 +17,11 @@
package cn.hippo4j.adapter.hystrix;
import cn.hippo4j.adapter.base.*;
import cn.hippo4j.adapter.base.ThreadPoolAdapter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterCacheConfig;
import cn.hippo4j.adapter.base.ThreadPoolAdapterParameter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterRegisterAction;
import cn.hippo4j.adapter.base.ThreadPoolAdapterState;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.toolkit.CollectionUtil;
import com.netflix.hystrix.HystrixThreadPool;
@ -48,9 +52,9 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
private static final String THREAD_POOLS_FIELD = "threadPools";
private final Map<String, ThreadPoolExecutor> HYSTRIX_CONSUME_EXECUTOR = new HashMap<>();
private final Map<String, ThreadPoolExecutor> hystrixConsumeExecutor = new HashMap<>();
private ThreadPoolAdapterScheduler threadPoolAdapterScheduler;
private final ThreadPoolAdapterScheduler threadPoolAdapterScheduler;
public HystrixThreadPoolAdapter(ThreadPoolAdapterScheduler threadPoolAdapterScheduler) {
this.threadPoolAdapterScheduler = threadPoolAdapterScheduler;
@ -64,7 +68,7 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
ThreadPoolExecutor threadPoolExecutor = HYSTRIX_CONSUME_EXECUTOR.get(identify);
ThreadPoolExecutor threadPoolExecutor = hystrixConsumeExecutor.get(identify);
if (threadPoolExecutor != null) {
result.setThreadPoolKey(identify);
result.setCoreSize(threadPoolExecutor.getCorePoolSize());
@ -78,14 +82,14 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
List<ThreadPoolAdapterState> threadPoolAdapterStates = new ArrayList<>();
HYSTRIX_CONSUME_EXECUTOR.forEach((kel, val) -> threadPoolAdapterStates.add(getThreadPoolState(kel)));
hystrixConsumeExecutor.forEach((kel, val) -> threadPoolAdapterStates.add(getThreadPoolState(kel)));
return threadPoolAdapterStates;
}
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
String threadPoolKey = threadPoolAdapterParameter.getThreadPoolKey();
ThreadPoolExecutor threadPoolExecutor = HYSTRIX_CONSUME_EXECUTOR.get(threadPoolKey);
ThreadPoolExecutor threadPoolExecutor = hystrixConsumeExecutor.get(threadPoolKey);
if (threadPoolExecutor == null) {
log.warn("[{}] Hystrix thread pool not found.", threadPoolKey);
return false;
@ -135,7 +139,7 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
threadPoolField.setAccessible(true);
ThreadPoolExecutor threadPoolExecutor =
(ThreadPoolExecutor) threadPoolField.get(hystrixThreadPoolDefault);
HYSTRIX_CONSUME_EXECUTOR.put(key, threadPoolExecutor);
hystrixConsumeExecutor.put(key, threadPoolExecutor);
}
}
}
@ -179,7 +183,7 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
private int taskIntervalSeconds;
public HystrixThreadPoolRefreshTask(ScheduledExecutorService scheduler, int taskIntervalSeconds) {
HystrixThreadPoolRefreshTask(ScheduledExecutorService scheduler, int taskIntervalSeconds) {
this.scheduler = scheduler;
this.taskIntervalSeconds = taskIntervalSeconds;
}
@ -196,6 +200,9 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
}
}
/**
* Thread Pool Adapter Register Task
*/
class ThreadPoolAdapterRegisterTask implements Runnable {
private ScheduledExecutorService scheduler;
@ -208,9 +215,9 @@ public class HystrixThreadPoolAdapter implements ThreadPoolAdapter, ApplicationL
private List<ThreadPoolAdapterCacheConfig> cacheConfigList = new ArrayList<>();
public ThreadPoolAdapterRegisterTask(ScheduledExecutorService scheduler, int taskIntervalSeconds,
Map<String, ThreadPoolAdapter> threadPoolAdapterMap,
ThreadPoolAdapterRegisterAction threadPoolAdapterRegisterAction) {
ThreadPoolAdapterRegisterTask(ScheduledExecutorService scheduler, int taskIntervalSeconds,
Map<String, ThreadPoolAdapter> threadPoolAdapterMap,
ThreadPoolAdapterRegisterAction threadPoolAdapterRegisterAction) {
this.scheduler = scheduler;
this.taskIntervalSeconds = taskIntervalSeconds;
this.threadPoolAdapterMap = threadPoolAdapterMap;

@ -27,7 +27,11 @@ import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
@ -42,11 +46,11 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
private static final String RABBITMQ = "RabbitMQ";
private static final String FiledName = "executorService";
private static final String FILED_NAME = "executorService";
private final Map<String, AbstractConnectionFactory> abstractConnectionFactoryMap;
private final Map<String, ThreadPoolExecutor> RABBITMQ_THREAD_POOL_TASK_EXECUTOR = new HashMap<>();
private final Map<String, ThreadPoolExecutor> rabbitmqThreadPoolTaskExecutor = new HashMap<>();
@Override
public String mark() {
@ -56,7 +60,7 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState threadPoolAdapterState = new ThreadPoolAdapterState();
ThreadPoolExecutor threadPoolTaskExecutor = RABBITMQ_THREAD_POOL_TASK_EXECUTOR.get(identify);
ThreadPoolExecutor threadPoolTaskExecutor = rabbitmqThreadPoolTaskExecutor.get(identify);
threadPoolAdapterState.setThreadPoolKey(identify);
if (Objects.nonNull(threadPoolTaskExecutor)) {
threadPoolAdapterState.setCoreSize(threadPoolTaskExecutor.getCorePoolSize());
@ -68,7 +72,7 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
List<ThreadPoolAdapterState> adapterStateList = new ArrayList<>();
RABBITMQ_THREAD_POOL_TASK_EXECUTOR.forEach(
rabbitmqThreadPoolTaskExecutor.forEach(
(key, val) -> adapterStateList.add(getThreadPoolState(key)));
return adapterStateList;
}
@ -76,7 +80,7 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
String threadPoolKey = threadPoolAdapterParameter.getThreadPoolKey();
ThreadPoolExecutor threadPoolTaskExecutor = RABBITMQ_THREAD_POOL_TASK_EXECUTOR.get(threadPoolKey);
ThreadPoolExecutor threadPoolTaskExecutor = rabbitmqThreadPoolTaskExecutor.get(threadPoolKey);
if (Objects.nonNull(threadPoolTaskExecutor)) {
int originalCoreSize = threadPoolTaskExecutor.getCorePoolSize();
int originalMaximumPoolSize = threadPoolTaskExecutor.getMaximumPoolSize();
@ -95,11 +99,11 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public void onApplicationEvent(ApplicationStartedEvent event) {
abstractConnectionFactoryMap.forEach((beanName, abstractConnectionFactor) -> {
ExecutorService executor = (ExecutorService) ReflectUtil.getFieldValue(abstractConnectionFactor, FiledName);
ExecutorService executor = (ExecutorService) ReflectUtil.getFieldValue(abstractConnectionFactor, FILED_NAME);
if (Objects.nonNull(executor)) {
if (executor instanceof ThreadPoolExecutor) {
ThreadPoolExecutor threadPoolTaskExecutor = (ThreadPoolExecutor) executor;
RABBITMQ_THREAD_POOL_TASK_EXECUTOR.put(beanName, threadPoolTaskExecutor);
rabbitmqThreadPoolTaskExecutor.put(beanName, threadPoolTaskExecutor);
log.info("Rabbitmq executor name {}", beanName);
} else {
log.warn("Custom thread pools only support ThreadPoolExecutor");

@ -43,7 +43,7 @@ import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMI
@Slf4j
public class RocketMQThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {
private final Map<String, ThreadPoolExecutor> ROCKET_MQ_CONSUME_EXECUTOR = new HashMap<>();
private final Map<String, ThreadPoolExecutor> rocketmqConsumeExecutor = new HashMap<>();
@Override
public String mark() {
@ -53,7 +53,7 @@ public class RocketMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
ThreadPoolExecutor rocketMQConsumeExecutor = ROCKET_MQ_CONSUME_EXECUTOR.get(identify);
ThreadPoolExecutor rocketMQConsumeExecutor = rocketmqConsumeExecutor.get(identify);
if (rocketMQConsumeExecutor != null) {
result.setThreadPoolKey(identify);
result.setCoreSize(rocketMQConsumeExecutor.getCorePoolSize());
@ -67,7 +67,7 @@ public class RocketMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
List<ThreadPoolAdapterState> adapterStateList = new ArrayList<>();
ROCKET_MQ_CONSUME_EXECUTOR.forEach(
rocketmqConsumeExecutor.forEach(
(key, val) -> adapterStateList.add(getThreadPoolState(key)));
return adapterStateList;
}
@ -75,7 +75,7 @@ public class RocketMQThreadPoolAdapter implements ThreadPoolAdapter, Application
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
String threadPoolKey = threadPoolAdapterParameter.getThreadPoolKey();
ThreadPoolExecutor rocketMQConsumeExecutor = ROCKET_MQ_CONSUME_EXECUTOR.get(threadPoolKey);
ThreadPoolExecutor rocketMQConsumeExecutor = rocketmqConsumeExecutor.get(threadPoolKey);
if (rocketMQConsumeExecutor != null) {
int originalCoreSize = rocketMQConsumeExecutor.getCorePoolSize();
int originalMaximumPoolSize = rocketMQConsumeExecutor.getMaximumPoolSize();
@ -101,7 +101,7 @@ public class RocketMQThreadPoolAdapter implements ThreadPoolAdapter, Application
if (defaultMQPushConsumer != null) {
ConsumeMessageService consumeMessageService = defaultMQPushConsumer.getDefaultMQPushConsumerImpl().getConsumeMessageService();
ThreadPoolExecutor consumeExecutor = (ThreadPoolExecutor) ReflectUtil.getFieldValue(consumeMessageService, "consumeExecutor");
ROCKET_MQ_CONSUME_EXECUTOR.put(container.getConsumerGroup(), consumeExecutor);
rocketmqConsumeExecutor.put(container.getConsumerGroup(), consumeExecutor);
}
}
} catch (Exception ex) {

@ -34,7 +34,12 @@ import org.springframework.cloud.stream.binding.InputBindingLifecycle;
import org.springframework.context.ApplicationListener;
import org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMITER;
@ -44,7 +49,7 @@ import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMI
@Slf4j
public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {
private final Map<String, AbstractMessageListenerContainer> ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR = new HashMap<>();
private final Map<String, AbstractMessageListenerContainer> rocketMqSpringCloudStreamConsumeExecutor = new HashMap<>();
@Override
public String mark() {
@ -54,7 +59,7 @@ public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAda
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
AbstractMessageListenerContainer messageListenerContainer = ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.get(identify);
AbstractMessageListenerContainer messageListenerContainer = rocketMqSpringCloudStreamConsumeExecutor.get(identify);
if (messageListenerContainer != null) {
result.setThreadPoolKey(identify);
if (messageListenerContainer instanceof SimpleMessageListenerContainer) {
@ -80,7 +85,7 @@ public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAda
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
List<ThreadPoolAdapterState> adapterStateList = new ArrayList<>();
ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.forEach(
rocketMqSpringCloudStreamConsumeExecutor.forEach(
(key, val) -> adapterStateList.add(getThreadPoolState(key)));
return adapterStateList;
}
@ -88,9 +93,9 @@ public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAda
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
String threadPoolKey = threadPoolAdapterParameter.getThreadPoolKey();
AbstractMessageListenerContainer messageListenerContainer = ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.get(threadPoolKey);
AbstractMessageListenerContainer messageListenerContainer = rocketMqSpringCloudStreamConsumeExecutor.get(threadPoolKey);
if (messageListenerContainer != null) {
synchronized (ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR) {
synchronized (rocketMqSpringCloudStreamConsumeExecutor) {
Integer corePoolSize = threadPoolAdapterParameter.getCorePoolSize();
Integer maximumPoolSize = threadPoolAdapterParameter.getMaximumPoolSize();
if (messageListenerContainer instanceof SimpleMessageListenerContainer) {
@ -148,7 +153,7 @@ public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAda
Object lifecycle = ReflectUtil.getFieldValue(defaultBinding, "lifecycle");
if (lifecycle instanceof AmqpInboundChannelAdapter) {
AbstractMessageListenerContainer rabbitMQListenerContainer = (AbstractMessageListenerContainer) ReflectUtil.getFieldValue(lifecycle, "messageListenerContainer");
ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.put(bindingName, rabbitMQListenerContainer);
rocketMqSpringCloudStreamConsumeExecutor.put(bindingName, rabbitMQListenerContainer);
}
}
} catch (Exception ex) {

@ -35,7 +35,12 @@ import org.springframework.cloud.stream.binder.DefaultBinding;
import org.springframework.cloud.stream.binding.InputBindingLifecycle;
import org.springframework.context.ApplicationListener;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ThreadPoolExecutor;
import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMITER;
@ -46,7 +51,7 @@ import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMI
@Slf4j
public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {
private final Map<String, ThreadPoolExecutor> ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR = new HashMap<>();
private final Map<String, ThreadPoolExecutor> rocketMqSpringCloudStreamConsumeExecutor = new HashMap<>();
@Override
public String mark() {
@ -56,7 +61,7 @@ public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAda
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
ThreadPoolAdapterState result = new ThreadPoolAdapterState();
ThreadPoolExecutor rocketMQConsumeExecutor = ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.get(identify);
ThreadPoolExecutor rocketMQConsumeExecutor = rocketMqSpringCloudStreamConsumeExecutor.get(identify);
if (rocketMQConsumeExecutor != null) {
result.setThreadPoolKey(identify);
result.setCoreSize(rocketMQConsumeExecutor.getCorePoolSize());
@ -70,7 +75,7 @@ public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAda
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
List<ThreadPoolAdapterState> adapterStateList = new ArrayList<>();
ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.forEach(
rocketMqSpringCloudStreamConsumeExecutor.forEach(
(key, val) -> adapterStateList.add(getThreadPoolState(key)));
return adapterStateList;
}
@ -78,7 +83,7 @@ public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAda
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
String threadPoolKey = threadPoolAdapterParameter.getThreadPoolKey();
ThreadPoolExecutor rocketMQConsumeExecutor = ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.get(threadPoolKey);
ThreadPoolExecutor rocketMQConsumeExecutor = rocketMqSpringCloudStreamConsumeExecutor.get(threadPoolKey);
if (rocketMQConsumeExecutor != null) {
int originalCoreSize = rocketMQConsumeExecutor.getCorePoolSize();
int originalMaximumPoolSize = rocketMQConsumeExecutor.getMaximumPoolSize();
@ -111,7 +116,7 @@ public class SpringCloudStreamRocketMQThreadPoolAdapter implements ThreadPoolAda
DefaultMQPushConsumerImpl defaultMQPushConsumerImpl = consumer.getDefaultMQPushConsumerImpl();
ConsumeMessageConcurrentlyService consumeMessageService = (ConsumeMessageConcurrentlyService) defaultMQPushConsumerImpl.getConsumeMessageService();
ThreadPoolExecutor consumeExecutor = (ThreadPoolExecutor) ReflectUtil.getFieldValue(consumeMessageService, "consumeExecutor");
ROCKET_MQ_SPRING_CLOUD_STREAM_CONSUME_EXECUTOR.put(bindingName, consumeExecutor);
rocketMqSpringCloudStreamConsumeExecutor.put(bindingName, consumeExecutor);
}
} catch (Exception ex) {
log.error("Failed to get input-bindings thread pool.", ex);

@ -31,7 +31,6 @@ import org.springframework.boot.web.server.WebServer;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@ -47,14 +46,14 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
private final AtomicBoolean cacheFlag = new AtomicBoolean(Boolean.FALSE);
private static String EXCEPTION_MESSAGE;
private static String exceptionMessage;
private final AbstractThreadPoolRuntime webThreadPoolRunStateHandler;
@Override
protected Executor getWebThreadPoolByServer(WebServer webServer) {
if (cacheFlag.get()) {
log.warn("Exception getting Tomcat thread pool. Exception message: {}", EXCEPTION_MESSAGE);
log.warn("Exception getting Tomcat thread pool. Exception message: {}", exceptionMessage);
return null;
}
Executor tomcatExecutor = null;
@ -62,8 +61,8 @@ public class TomcatWebThreadPoolHandler extends AbstractWebThreadPoolService {
tomcatExecutor = ((TomcatWebServer) webServer).getTomcat().getConnector().getProtocolHandler().getExecutor();
} catch (Exception ex) {
cacheFlag.set(Boolean.TRUE);
EXCEPTION_MESSAGE = ex.getMessage();
log.error("Failed to get Tomcat thread pool. Message: {}", EXCEPTION_MESSAGE);
exceptionMessage = ex.getMessage();
log.error("Failed to get Tomcat thread pool. Message: {}", exceptionMessage);
}
return tomcatExecutor;
}

@ -35,12 +35,12 @@ import java.util.concurrent.atomic.AtomicReference;
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
public class WebIpAndPortHolder {
private static boolean SUPPORT_VERSION = false;
private static boolean supportVersion = false;
static {
try {
Class.forName("org.springframework.boot.web.server.WebServer");
SUPPORT_VERSION = true;
supportVersion = true;
} catch (Exception ignored) {
}
}
@ -48,17 +48,17 @@ public class WebIpAndPortHolder {
/**
* Application ip and application post
*/
protected static AtomicReference<WebIpAndPortInfo> WEB_IP_AND_PORT = new AtomicReference<>();
protected static AtomicReference<WebIpAndPortInfo> webIpAndPort = new AtomicReference<>();
public static final String ALL = "*";
protected static final String SEPARATOR = ",";
protected static void initIpAndPort() {
if (!SUPPORT_VERSION) {
if (!supportVersion) {
return;
}
WEB_IP_AND_PORT.compareAndSet(null, getWebIpAndPortInfo());
webIpAndPort.compareAndSet(null, getWebIpAndPortInfo());
}
private static WebIpAndPortInfo getWebIpAndPortInfo() {
@ -80,10 +80,10 @@ public class WebIpAndPortHolder {
* @return Web ip and port info
*/
public static WebIpAndPortInfo getWebIpAndPort() {
if (WEB_IP_AND_PORT.get() == null) {
if (webIpAndPort.get() == null) {
initIpAndPort();
}
return WebIpAndPortHolder.WEB_IP_AND_PORT.get();
return WebIpAndPortHolder.webIpAndPort.get();
}
/**
@ -104,4 +104,4 @@ public class WebIpAndPortHolder {
.filter(Objects::nonNull)
.anyMatch(each -> each.check(webIpAndPort.getIpSegment(), webIpAndPort.getPort()));
}
}
}

Loading…
Cancel
Save