From 7f3721c5974485bf993e93a86b592cbc2175a892 Mon Sep 17 00:00:00 2001 From: iwangjie <345127857@qq.com> Date: Wed, 16 Nov 2022 11:08:39 +0800 Subject: [PATCH] support dubboX from demand #624 --- .../hippo4j-adapter-dubboX/pom.xml | 19 ++++++++ .../dubbo/DubboXThreadPoolAdapter.java | 32 +++++++++++++ hippo4j-adapter/pom.xml | 1 + .../pom.xml | 6 +++ .../pom.xml | 19 ++++++++ .../dubbo/DubboXAdapterAutoConfiguration.java | 46 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 1 + .../pom.xml | 1 + 8 files changed, 125 insertions(+) create mode 100644 hippo4j-adapter/hippo4j-adapter-dubboX/pom.xml create mode 100644 hippo4j-adapter/hippo4j-adapter-dubboX/src/main/java/cn/hippo4j/adapter/dubbo/DubboXThreadPoolAdapter.java create mode 100644 hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/pom.xml create mode 100644 hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/java/cn/hippo4j/springboot/starter/adapter/dubbo/DubboXAdapterAutoConfiguration.java create mode 100644 hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/resources/META-INF/spring.factories diff --git a/hippo4j-adapter/hippo4j-adapter-dubboX/pom.xml b/hippo4j-adapter/hippo4j-adapter-dubboX/pom.xml new file mode 100644 index 00000000..450296ee --- /dev/null +++ b/hippo4j-adapter/hippo4j-adapter-dubboX/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + cn.hippo4j + hippo4j-adapter + ${revision} + + hippo4j-adapter-dubboX + + + + cn.hippo4j + hippo4j-adapter-dubbo + ${revision} + + + diff --git a/hippo4j-adapter/hippo4j-adapter-dubboX/src/main/java/cn/hippo4j/adapter/dubbo/DubboXThreadPoolAdapter.java b/hippo4j-adapter/hippo4j-adapter-dubboX/src/main/java/cn/hippo4j/adapter/dubbo/DubboXThreadPoolAdapter.java new file mode 100644 index 00000000..69108a2c --- /dev/null +++ b/hippo4j-adapter/hippo4j-adapter-dubboX/src/main/java/cn/hippo4j/adapter/dubbo/DubboXThreadPoolAdapter.java @@ -0,0 +1,32 @@ +/* + * 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.dubbo; + +import lombok.extern.slf4j.Slf4j; + +/** + * DubboX thread-pool adapter. + */ +@Slf4j +public class DubboXThreadPoolAdapter extends DubboThreadPoolAdapter{ + + @Override + public String mark() { + return "DubboX"; + } +} diff --git a/hippo4j-adapter/pom.xml b/hippo4j-adapter/pom.xml index 1993176c..50fd2f68 100644 --- a/hippo4j-adapter/pom.xml +++ b/hippo4j-adapter/pom.xml @@ -13,6 +13,7 @@ hippo4j-adapter-base hippo4j-adapter-dubbo + hippo4j-adapter-dubboX hippo4j-adapter-alibaba-dubbo hippo4j-adapter-rabbitmq hippo4j-adapter-rocketmq diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubbo/pom.xml b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubbo/pom.xml index 47abf897..974975af 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubbo/pom.xml +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubbo/pom.xml @@ -15,5 +15,11 @@ hippo4j-adapter-dubbo ${revision} + + cn.hippo4j + hippo4j-adapter-dubboX + 1.5.0-SNAPSHOT + compile + diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/pom.xml b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/pom.xml new file mode 100644 index 00000000..7baf5959 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + cn.hippo4j + hippo4j-spring-boot-starter-adapter + ${revision} + + hippo4j-spring-boot-starter-adapter-dubboX + + + + cn.hippo4j + hippo4j-adapter-dubboX + ${revision} + + + diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/java/cn/hippo4j/springboot/starter/adapter/dubbo/DubboXAdapterAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/java/cn/hippo4j/springboot/starter/adapter/dubbo/DubboXAdapterAutoConfiguration.java new file mode 100644 index 00000000..0f9bc125 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/java/cn/hippo4j/springboot/starter/adapter/dubbo/DubboXAdapterAutoConfiguration.java @@ -0,0 +1,46 @@ +/* + * 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.springboot.starter.adapter.dubbo; + +import cn.hippo4j.adapter.dubbo.DubboThreadPoolAdapter; +import cn.hippo4j.adapter.dubbo.DubboXThreadPoolAdapter; +import cn.hippo4j.common.config.ApplicationContextHolder; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * DubboX adapter auto configuration. + */ +@Configuration +public class DubboXAdapterAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + public ApplicationContextHolder simpleApplicationContextHolder() { + return new ApplicationContextHolder(); + } + + @Bean + @SuppressWarnings("all") + @ConditionalOnProperty(name = "dubbo.application.name") + public DubboThreadPoolAdapter dubboThreadPoolAdapter(ApplicationContextHolder applicationContextHolder) { + return new DubboXThreadPoolAdapter(); + } +} diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/resources/META-INF/spring.factories b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..f3408a36 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-dubboX/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=cn.hippo4j.springboot.starter.adapter.dubbo.DubboXAdapterAutoConfiguration diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/pom.xml b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/pom.xml index 258c092e..6176f4cd 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/pom.xml +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/pom.xml @@ -13,6 +13,7 @@ hippo4j-spring-boot-starter-adapter-all hippo4j-spring-boot-starter-adapter-dubbo + hippo4j-spring-boot-starter-adapter-dubboX hippo4j-spring-boot-starter-adapter-alibaba-dubbo hippo4j-spring-boot-starter-adapter-rabbitmq hippo4j-spring-boot-starter-adapter-rocketmq