Remove useless modules and refactor code

pull/909/head
chen.ma 3 years ago
parent 322b9b8aa1
commit 5931f1be0e

@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ThreadPoolAdapterBeanContainer implements InitializingBean { public class ThreadPoolAdapterBeanContainer implements InitializingBean {
/** /**
* Store three-party thread pool framework bean instances. * Store three-party thread pool framework bean instances
*/ */
public static final Map<String, ThreadPoolAdapter> THREAD_POOL_ADAPTER_BEAN_CONTAINER = new ConcurrentHashMap<>(); public static final Map<String, ThreadPoolAdapter> THREAD_POOL_ADAPTER_BEAN_CONTAINER = new ConcurrentHashMap<>();

@ -28,7 +28,7 @@ public interface ThreadPoolAdapterRegisterAction {
/** /**
* Get thread pool adapter cache configs. * Get thread pool adapter cache configs.
* *
* @param threadPoolAdapterMap * @param threadPoolAdapterMap thread-pool adapter map
* @return List<ThreadPoolAdapterCacheConfig> * @return List<ThreadPoolAdapterCacheConfig>
*/ */
List<ThreadPoolAdapterCacheConfig> getThreadPoolAdapterCacheConfigs(Map<String, ThreadPoolAdapter> threadPoolAdapterMap); List<ThreadPoolAdapterCacheConfig> getThreadPoolAdapterCacheConfigs(Map<String, ThreadPoolAdapter> threadPoolAdapterMap);
@ -36,8 +36,7 @@ public interface ThreadPoolAdapterRegisterAction {
/** /**
* Do register. * Do register.
* *
* @param cacheConfigList * @param cacheConfigList cache config list
* @return
*/ */
void doRegister(List<ThreadPoolAdapterCacheConfig> cacheConfigList); void doRegister(List<ThreadPoolAdapterCacheConfig> cacheConfigList);
} }

@ -18,6 +18,7 @@
package cn.hippo4j.adapter.hystrix; package cn.hippo4j.adapter.hystrix;
import cn.hippo4j.common.design.builder.ThreadFactoryBuilder; import cn.hippo4j.common.design.builder.ThreadFactoryBuilder;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
@ -31,6 +32,7 @@ public class ThreadPoolAdapterScheduler {
private static final int TASK_INTERVAL_SECONDS = 10; private static final int TASK_INTERVAL_SECONDS = 10;
@Getter
private final ScheduledExecutorService scheduler; private final ScheduledExecutorService scheduler;
public ThreadPoolAdapterScheduler() { public ThreadPoolAdapterScheduler() {
@ -41,10 +43,11 @@ public class ThreadPoolAdapterScheduler {
.build()); .build());
} }
public ScheduledExecutorService getScheduler() { /**
return scheduler; * Gt task interval seconds.
} *
* @return task interval seconds
*/
public int getTaskIntervalSeconds() { public int getTaskIntervalSeconds() {
return TASK_INTERVAL_SECONDS; return TASK_INTERVAL_SECONDS;
} }

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hippo4j-adapter-kafka</artifactId>
<dependencies>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter-base</artifactId>
</dependency>
</dependencies>
</project>

@ -1,52 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.hippo4j.adapter.kafka;
import cn.hippo4j.adapter.base.ThreadPoolAdapter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterParameter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterState;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
/**
* Kafka thread-pool adapter.
*/
@Slf4j
public class KafkaThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {
@Override
public String mark() {
return "Kafka";
}
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
return null;
}
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
return false;
}
@Override
public void onApplicationEvent(ApplicationStartedEvent event) {
}
}

@ -105,7 +105,6 @@ public class RabbitMQThreadPoolAdapter implements ThreadPoolAdapter, Application
log.warn("Custom thread pools only support ThreadPoolExecutor"); log.warn("Custom thread pools only support ThreadPoolExecutor");
} }
} }
}); });
} }
} }

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hippo4j-adapter-spring-cloud-stream-kafka</artifactId>
<dependencies>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter-base</artifactId>
</dependency>
</dependencies>
</project>

@ -1,59 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.hippo4j.adapter.springcloud.stream.kafka;
import cn.hippo4j.adapter.base.ThreadPoolAdapter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterParameter;
import cn.hippo4j.adapter.base.ThreadPoolAdapterState;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import java.util.List;
/**
* Spring cloud stream kafka thread-pool adapter.
*/
@Slf4j
public class SpringCloudStreamKafkaThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {
@Override
public String mark() {
return "KafkaSpringCloudStream";
}
@Override
public ThreadPoolAdapterState getThreadPoolState(String identify) {
return null;
}
@Override
public List<ThreadPoolAdapterState> getThreadPoolStates() {
return null;
}
@Override
public boolean updateThreadPool(ThreadPoolAdapterParameter threadPoolAdapterParameter) {
return false;
}
@Override
public void onApplicationEvent(ApplicationStartedEvent event) {
}
}

@ -39,7 +39,7 @@ import java.util.*;
import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMITER; import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMITER;
/** /**
* Spring cloud stream rabbimq thread-pool adapter. * Spring cloud stream rabbit-mq thread-pool adapter.
*/ */
@Slf4j @Slf4j
public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> { public class SpringCloudStreamRabbitMQThreadPoolAdapter implements ThreadPoolAdapter, ApplicationListener<ApplicationStartedEvent> {

@ -34,12 +34,12 @@ import java.util.concurrent.Executor;
public abstract class AbstractWebThreadPoolService implements WebThreadPoolService, ApplicationRunner { public abstract class AbstractWebThreadPoolService implements WebThreadPoolService, ApplicationRunner {
/** /**
* Thread pool executor. * Thread pool executor
*/ */
protected volatile Executor executor; protected volatile Executor executor;
/** /**
* Get web thread pool by server. * Get web thread pool by server
* *
* @param webServer * @param webServer
* @return * @return

@ -30,7 +30,7 @@ public class WebThreadPoolHandlerChoose {
/** /**
* Choose the web thread pool service bean. * Choose the web thread pool service bean.
* *
* @return * @return web thread pool service bean
*/ */
public WebThreadPoolService choose() { public WebThreadPoolService choose() {
WebThreadPoolService webThreadPoolService; WebThreadPoolService webThreadPoolService;

@ -35,9 +35,9 @@ public class WebThreadPoolRunStateHandler extends AbstractThreadPoolRuntime {
long used = MemoryUtil.heapMemoryUsed(); long used = MemoryUtil.heapMemoryUsed();
long max = MemoryUtil.heapMemoryMax(); long max = MemoryUtil.heapMemoryMax();
String memoryProportion = StringUtil.newBuilder( String memoryProportion = StringUtil.newBuilder(
"已分配: ", "Allocation: ",
ByteConvertUtil.getPrintSize(used), ByteConvertUtil.getPrintSize(used),
" / 最大可用: ", " / Maximum available: ",
ByteConvertUtil.getPrintSize(max)); ByteConvertUtil.getPrintSize(max));
poolRunStateInfo.setCurrentLoad(poolRunStateInfo.getCurrentLoad() + "%"); poolRunStateInfo.setCurrentLoad(poolRunStateInfo.getCurrentLoad() + "%");
poolRunStateInfo.setPeakLoad(poolRunStateInfo.getPeakLoad() + "%"); poolRunStateInfo.setPeakLoad(poolRunStateInfo.getPeakLoad() + "%");

@ -14,12 +14,10 @@
<module>hippo4j-adapter-base</module> <module>hippo4j-adapter-base</module>
<module>hippo4j-adapter-dubbo</module> <module>hippo4j-adapter-dubbo</module>
<module>hippo4j-adapter-alibaba-dubbo</module> <module>hippo4j-adapter-alibaba-dubbo</module>
<module>hippo4j-adapter-kafka</module>
<module>hippo4j-adapter-rabbitmq</module> <module>hippo4j-adapter-rabbitmq</module>
<module>hippo4j-adapter-rocketmq</module> <module>hippo4j-adapter-rocketmq</module>
<module>hippo4j-adapter-hystrix</module> <module>hippo4j-adapter-hystrix</module>
<module>hippo4j-adapter-spring-cloud-stream-rocketmq</module> <module>hippo4j-adapter-spring-cloud-stream-rocketmq</module>
<module>hippo4j-adapter-spring-cloud-stream-kafka</module>
<module>hippo4j-adapter-spring-cloud-stream-rabbitmq</module> <module>hippo4j-adapter-spring-cloud-stream-rabbitmq</module>
<module>hippo4j-adapter-web</module> <module>hippo4j-adapter-web</module>
</modules> </modules>

Loading…
Cancel
Save