Changed Hippo4j class and method naming

pull/1165/head
chen.ma 1 year ago
parent be636bf08a
commit 56e39abb3b

@ -31,7 +31,7 @@ public class UtilAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public InetUtils hippo4JInetUtils(InetUtilsProperties inetUtilsProperties) {
public InetUtils hippo4jInetUtils(InetUtilsProperties inetUtilsProperties) {
return new InetUtils(inetUtilsProperties);
}
}

@ -41,7 +41,7 @@ import static cn.hippo4j.core.toolkit.IdentifyUtil.CLIENT_IDENTIFICATION_VALUE;
@AllArgsConstructor
public class ThreadPoolRunStateHandler extends AbstractThreadPoolRuntime {
private final InetUtils hippo4JInetUtils;
private final InetUtils hippo4jInetUtils;
private final ConfigurableEnvironment environment;
@ -56,7 +56,7 @@ public class ThreadPoolRunStateHandler extends AbstractThreadPoolRuntime {
ByteConvertUtil.getPrintSize(max));
poolRunStateInfo.setCurrentLoad(poolRunStateInfo.getCurrentLoad() + "%");
poolRunStateInfo.setPeakLoad(poolRunStateInfo.getPeakLoad() + "%");
String ipAddress = hippo4JInetUtils.findFirstNonLoopBackHostInfo().getIpAddress();
String ipAddress = hippo4jInetUtils.findFirstNonLoopBackHostInfo().getIpAddress();
poolRunStateInfo.setHost(ipAddress);
poolRunStateInfo.setMemoryProportion(memoryProportion);
poolRunStateInfo.setFreeMemory(ByteConvertUtil.getPrintSize(Math.subtractExact(max, used)));

@ -34,10 +34,10 @@ public class BaseSpringApplicationRunListener implements SpringApplicationRunLis
private final String[] args;
private List<Hippo4JApplicationListener> hippo4JApplicationListeners = new ArrayList();
private List<Hippo4jApplicationListener> hippo4jApplicationListeners = new ArrayList();
{
hippo4JApplicationListeners.add(new StartingApplicationListener());
hippo4jApplicationListeners.add(new StartingApplicationListener());
}
public BaseSpringApplicationRunListener(SpringApplication application, String[] args) {
@ -47,22 +47,22 @@ public class BaseSpringApplicationRunListener implements SpringApplicationRunLis
@Override
public void starting() {
hippo4JApplicationListeners.forEach(each -> each.starting());
hippo4jApplicationListeners.forEach(each -> each.starting());
}
@Override
public void contextPrepared(ConfigurableApplicationContext context) {
hippo4JApplicationListeners.forEach(each -> each.contextPrepared(context));
hippo4jApplicationListeners.forEach(each -> each.contextPrepared(context));
}
@Override
public void started(ConfigurableApplicationContext context) {
hippo4JApplicationListeners.forEach(each -> each.started(context));
hippo4jApplicationListeners.forEach(each -> each.started(context));
}
@Override
public void failed(ConfigurableApplicationContext context, Throwable exception) {
hippo4JApplicationListeners.forEach(each -> each.failed(context, exception));
hippo4jApplicationListeners.forEach(each -> each.failed(context, exception));
}
@Override

@ -22,7 +22,7 @@ import org.springframework.context.ConfigurableApplicationContext;
/**
* Hippo4J application listener.
*/
public interface Hippo4JApplicationListener {
public interface Hippo4jApplicationListener {
/**
* {@link BaseSpringApplicationRunListener#starting}

@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit;
* Starting application listener.
*/
@Slf4j
public class StartingApplicationListener implements Hippo4JApplicationListener {
public class StartingApplicationListener implements Hippo4jApplicationListener {
private volatile boolean starting;
@ -53,7 +53,7 @@ public class StartingApplicationListener implements Hippo4JApplicationListener {
});
scheduledExecutorService.scheduleWithFixedDelay(() -> {
if (starting) {
log.info("Hippo4J is starting...");
log.info("Hippo4j is starting...");
}
}, 1, 1, TimeUnit.SECONDS);
}
@ -64,7 +64,7 @@ public class StartingApplicationListener implements Hippo4JApplicationListener {
starting = false;
closeExecutor();
if (EnvUtil.getStandaloneMode()) {
log.info("Hippo4J started successfully...");
log.info("Hippo4j started successfully...");
}
}
@ -73,8 +73,8 @@ public class StartingApplicationListener implements Hippo4JApplicationListener {
log.error("Startup errors: {}", exception);
closeExecutor();
context.close();
log.error("Hippo4J failed to start, please see {} for more details.",
Paths.get(EnvUtil.getHippo4JHome(), "logs/hippo4j.log"));
log.error("Hippo4j failed to start, please see {} for more details.",
Paths.get(EnvUtil.getHippo4jHome(), "logs/hippo4j.log"));
}
private void closeExecutor() {

@ -1,6 +1,6 @@
__ __ ___ ___ __
| |--.|__|.-----..-----..-----.| | | |__| Hippo4J ${application.version}
| |--.|__|.-----..-----..-----.| | | |__| Hippo4j ${application.version}
| || || _ || _ || _ || | | | | Port: ${server.port} PID: ${pid}
|__|__||__|| __|| __||_____||____ | | |
|__| |__| |: ||___| Site: https://hippo4j.cn

@ -34,7 +34,7 @@ public class CommonConfig {
@Bean
@ConditionalOnMissingBean
public ApplicationContextHolder hippo4JApplicationContextHolder() {
public ApplicationContextHolder hippo4jApplicationContextHolder() {
return new ApplicationContextHolder();
}

@ -40,7 +40,7 @@ public class EnvUtil {
*
* @return
*/
public static String getHippo4JHome() {
public static String getHippo4jHome() {
if (StringUtil.isBlank(HIPPO4J_HOME_PATH)) {
String hippo4jHome = System.getProperty(HIPPO4J_HOME_KEY);
if (StringUtil.isBlank(hippo4jHome)) {

@ -27,9 +27,9 @@ import org.junit.Test;
public class EnvUtilTest {
@Test
public void getHippo4JHomeTest() {
String hippo4JHome = EnvUtil.getHippo4JHome();
Assert.isTrue(StringUtil.isNotBlank(hippo4JHome));
public void getHippo4jHomeTest() {
String hippo4jHome = EnvUtil.getHippo4jHome();
Assert.isTrue(StringUtil.isNotBlank(hippo4jHome));
}
@Test

@ -19,7 +19,6 @@ package cn.hippo4j.config.springboot.starter.config;
import cn.hippo4j.adapter.web.WebThreadPoolService;
import cn.hippo4j.common.api.ThreadPoolCheckAlarm;
import cn.hippo4j.common.api.ThreadPoolConfigChange;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.config.springboot.starter.monitor.ThreadPoolMonitorExecutor;
@ -36,7 +35,12 @@ import cn.hippo4j.core.enable.MarkerConfiguration;
import cn.hippo4j.core.handler.DynamicThreadPoolBannerHandler;
import cn.hippo4j.message.api.NotifyConfigBuilder;
import cn.hippo4j.message.config.MessageConfiguration;
import cn.hippo4j.message.service.*;
import cn.hippo4j.message.service.AlarmControlHandler;
import cn.hippo4j.message.service.DefaultThreadPoolCheckAlarmHandler;
import cn.hippo4j.message.service.DefaultThreadPoolConfigChangeHandler;
import cn.hippo4j.message.service.Hippo4jBaseSendMessageService;
import cn.hippo4j.message.service.Hippo4jSendMessageService;
import cn.hippo4j.message.service.WebThreadPoolConfigChangeHandler;
import cn.hippo4j.springboot.starter.adapter.web.WebAdapterConfiguration;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.ObjectProvider;
@ -52,8 +56,6 @@ import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import java.util.Optional;
/**
* Dynamic thread-pool auto-configuration.
*
@ -77,7 +79,7 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ApplicationContextHolder hippo4JApplicationContextHolder() {
public ApplicationContextHolder hippo4jApplicationContextHolder() {
return new ApplicationContextHolder();
}
@ -110,7 +112,7 @@ public class DynamicThreadPoolAutoConfiguration {
}
@Bean
public DynamicThreadPoolPostProcessor dynamicThreadPoolPostProcessor(ApplicationContextHolder hippo4JApplicationContextHolder) {
public DynamicThreadPoolPostProcessor dynamicThreadPoolPostProcessor(ApplicationContextHolder hippo4jApplicationContextHolder) {
return new DynamicThreadPoolPostProcessor(bootstrapConfigProperties);
}

@ -54,8 +54,8 @@ public class WebAdapterConfiguration {
@Bean
@SuppressWarnings("all")
public ThreadPoolRunStateHandler threadPoolRunStateHandler(InetUtils hippo4JInetUtils) {
return new ThreadPoolRunStateHandler(hippo4JInetUtils, environment);
public ThreadPoolRunStateHandler threadPoolRunStateHandler(InetUtils hippo4jInetUtils) {
return new ThreadPoolRunStateHandler(hippo4jInetUtils, environment);
}
@Bean

@ -37,11 +37,11 @@ public class DiscoveryConfiguration {
private final BootstrapProperties bootstrapProperties;
private final InetUtils hippo4JInetUtils;
private final InetUtils hippo4jInetUtils;
@Bean
public InstanceInfo instanceConfig() {
return InstanceInfoProviderFactory.getInstance(environment, bootstrapProperties, hippo4JInetUtils);
return InstanceInfoProviderFactory.getInstance(environment, bootstrapProperties, hippo4jInetUtils);
}
@Bean
@ -50,7 +50,7 @@ public class DiscoveryConfiguration {
}
@Bean
public DiscoveryClient hippo4JDiscoveryClient(HttpAgent httpAgent,
public DiscoveryClient hippo4jDiscoveryClient(HttpAgent httpAgent,
InstanceInfo instanceInfo,
ClientShutdown hippo4jClientShutdown) {
return new DiscoveryClient(httpAgent, instanceInfo, hippo4jClientShutdown);

@ -106,17 +106,17 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@Order(Ordered.HIGHEST_PRECEDENCE)
public ApplicationContextHolder hippo4JApplicationContextHolder() {
public ApplicationContextHolder hippo4jApplicationContextHolder() {
return new ApplicationContextHolder();
}
@Bean
public ClientWorker hippo4jClientWorker(HttpAgent httpAgent,
InetUtils hippo4JInetUtils,
InetUtils hippo4jInetUtils,
ServerHealthCheck serverHealthCheck,
DynamicThreadPoolBannerHandler dynamicThreadPoolBannerHandlers,
ClientShutdown hippo4jClientShutdown) {
String identify = IdentifyUtil.generate(environment, hippo4JInetUtils);
String identify = IdentifyUtil.generate(environment, hippo4jInetUtils);
return new ClientWorker(httpAgent, identify, serverHealthCheck, dynamicThreadPoolBannerHandlers.getVersion(), hippo4jClientShutdown);
}
@ -138,7 +138,7 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@SuppressWarnings("all")
public DynamicThreadPoolPostProcessor threadPoolBeanPostProcessor(HttpAgent httpAgent,
ApplicationContextHolder hippo4JApplicationContextHolder,
ApplicationContextHolder hippo4jApplicationContextHolder,
DynamicThreadPoolSubscribeConfig dynamicThreadPoolSubscribeConfig) {
return new DynamicThreadPoolPostProcessor(properties, httpAgent, dynamicThreadPoolSubscribeConfig);
}
@ -182,8 +182,8 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@SuppressWarnings("all")
public ThreadPoolAdapterController threadPoolAdapterController(InetUtils hippo4JInetUtils) {
return new ThreadPoolAdapterController(environment, hippo4JInetUtils);
public ThreadPoolAdapterController threadPoolAdapterController(InetUtils hippo4jInetUtils) {
return new ThreadPoolAdapterController(environment, hippo4jInetUtils);
}
@Bean
@ -205,8 +205,8 @@ public class DynamicThreadPoolAutoConfiguration {
@Bean
@SuppressWarnings("all")
public ThreadPoolAdapterRegister threadPoolAdapterRegister(HttpAgent httpAgent,
InetUtils hippo4JInetUtils) {
return new ThreadPoolAdapterRegister(httpAgent, properties, environment, hippo4JInetUtils);
InetUtils hippo4jInetUtils) {
return new ThreadPoolAdapterRegister(httpAgent, properties, environment, hippo4jInetUtils);
}
@Bean

@ -49,7 +49,7 @@ import static cn.hippo4j.adapter.base.ThreadPoolAdapterBeanContainer.THREAD_POOL
public class ThreadPoolAdapterController {
private final ConfigurableEnvironment environment;
private final InetUtils hippo4JInetUtils;
private final InetUtils hippo4jInetUtils;
@GetMapping("/adapter/thread-pool/info")
public Result<ThreadPoolAdapterState> getAdapterThreadPool(ThreadPoolAdapterParameter requestParameter) {
@ -64,7 +64,7 @@ public class ThreadPoolAdapterController {
if (customerNetwork != null) {
clientAddress = StringUtil.newBuilder(customerNetwork[0], ":", customerNetwork[1]);
} else {
clientAddress = CloudCommonIdUtil.getClientIpPort(environment, hippo4JInetUtils);
clientAddress = CloudCommonIdUtil.getClientIpPort(environment, hippo4jInetUtils);
}
threadPoolState.setClientAddress(clientAddress);
threadPoolState.setIdentify(IdentifyUtil.getIdentify());

@ -55,7 +55,7 @@ public class ThreadPoolAdapterRegister implements ApplicationRunner, ThreadPoolA
private final ConfigurableEnvironment environment;
private final InetUtils hippo4JInetUtils;
private final InetUtils hippo4jInetUtils;
@Override
public void run(ApplicationArguments args) throws Exception {
@ -76,7 +76,7 @@ public class ThreadPoolAdapterRegister implements ApplicationRunner, ThreadPoolA
String tenantItemKey = properties.getNamespace() + IDENTIFY_SLICER_SYMBOL + properties.getItemId();
cacheConfig.setTenantItemKey(tenantItemKey);
cacheConfig.setClientIdentify(IdentifyUtil.getIdentify());
String clientAddress = CloudCommonIdUtil.getClientIpPort(environment, hippo4JInetUtils);
String clientAddress = CloudCommonIdUtil.getClientIpPort(environment, hippo4jInetUtils);
cacheConfig.setClientAddress(clientAddress);
cacheConfig.setThreadPoolAdapterStates(threadPoolStates);
adapterCacheConfigList.add(cacheConfig);

Loading…
Cancel
Save