From d6d6d3c81e0bcad9bf1b85199e6495ffde75bbe7 Mon Sep 17 00:00:00 2001 From: YuLuo Date: Sun, 19 May 2024 07:34:34 +0800 Subject: [PATCH] [chore] optimize code style (#2000) Signed-off-by: yuluo-yx Co-authored-by: tomsun28 --- hip/README.md | 2 +- hip/TEMPLATE.md | 2 +- hip/hip-01.md | 2 +- .../src/main/java/org/apache/hertzbeat/plugin/Plugin.java | 5 ++--- .../org/apache/hertzbeat/plugin/impl/DemoPluginImpl.java | 7 ++++--- .../META-INF/services/org.apache.hertzbeat.plugin.Plugin | 2 +- push/src/main/resources/META-INF/spring.factories | 2 +- .../java/org/apache/hertzbeat/remoting/RemotingServer.java | 4 ++++ script/docker/server/README.md | 1 - .../org/apache/hertzbeat/warehouse/dao/HistoryDao.java | 1 - .../listener/WareHouseApplicationReadyListener.java | 4 +--- .../warehouse/store/history/HistoryDataReader.java | 2 +- .../warehouse/store/history/HistoryDataWriter.java | 2 +- .../history/vm/VictoriaMetricsClusterDataStorage.java | 2 -- warehouse/src/main/resources/META-INF/spring.factories | 2 +- .../hertzbeat/warehouse/store/MemoryDataStorageTest.java | 2 +- .../warehouse/store/MetricsDataRedisCodecTest.java | 2 +- .../hertzbeat/warehouse/store/RedisDataStorageTest.java | 2 +- .../hertzbeat/warehouse/store/TdEngineDataStorageTest.java | 2 +- 19 files changed, 23 insertions(+), 25 deletions(-) diff --git a/hip/README.md b/hip/README.md index d52077b7566..038d2a9cb2f 100644 --- a/hip/README.md +++ b/hip/README.md @@ -90,4 +90,4 @@ It is advised to create a master GitHub issue to formulate the execution plan an - Merged PR means the HIP was accepted. - Closed PR means the HIP was rejected. - Open PR means the HIP was submitted and is in the process of discussion. -2. You can also take a look at the file in the `hip` folder. Each one is an approved HIP. \ No newline at end of file +2. You can also take a look at the file in the `hip` folder. Each one is an approved HIP. diff --git a/hip/TEMPLATE.md b/hip/TEMPLATE.md index 2dafb39ab21..29689aed402 100644 --- a/hip/TEMPLATE.md +++ b/hip/TEMPLATE.md @@ -140,4 +140,4 @@ If there are alternatives that were already considered by the authors or, after Updated afterwards --> * Mailing List discussion thread: -* Mailing List voting thread: \ No newline at end of file +* Mailing List voting thread: diff --git a/hip/hip-01.md b/hip/hip-01.md index b2f1fd9e310..51fdc5af460 100644 --- a/hip/hip-01.md +++ b/hip/hip-01.md @@ -51,4 +51,4 @@ Supplement the relevant unit tests. Updated afterwards --> * Mailing List discussion thread: https://lists.apache.org/thread/cvvo7xg35fxq7kml5ggdrcdygrx6yvyj -* Mailing List voting thread: https://lists.apache.org/thread/1s7dhrb27qfdx1gsh29dvmo8frjbt619 \ No newline at end of file +* Mailing List voting thread: https://lists.apache.org/thread/1s7dhrb27qfdx1gsh29dvmo8frjbt619 diff --git a/plugin/src/main/java/org/apache/hertzbeat/plugin/Plugin.java b/plugin/src/main/java/org/apache/hertzbeat/plugin/Plugin.java index 33739770625..d72632925b5 100644 --- a/plugin/src/main/java/org/apache/hertzbeat/plugin/Plugin.java +++ b/plugin/src/main/java/org/apache/hertzbeat/plugin/Plugin.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package org.apache.hertzbeat.plugin; import org.apache.hertzbeat.common.entity.alerter.Alert; @@ -25,8 +24,8 @@ */ public interface Plugin { - /* - * execute when alert + /** + * execute when alert */ void alert(Alert alert); } diff --git a/plugin/src/main/java/org/apache/hertzbeat/plugin/impl/DemoPluginImpl.java b/plugin/src/main/java/org/apache/hertzbeat/plugin/impl/DemoPluginImpl.java index 94f90664dee..f263b172ed7 100644 --- a/plugin/src/main/java/org/apache/hertzbeat/plugin/impl/DemoPluginImpl.java +++ b/plugin/src/main/java/org/apache/hertzbeat/plugin/impl/DemoPluginImpl.java @@ -15,7 +15,6 @@ * limitations under the License. */ - package org.apache.hertzbeat.plugin.impl; import lombok.extern.slf4j.Slf4j; @@ -27,11 +26,13 @@ */ @Slf4j public class DemoPluginImpl implements Plugin { - /* - * execute when alert + + /** + * execute when alert */ @Override public void alert(Alert alert) { log.info("DemoPluginImpl alert: {}", alert); } + } diff --git a/plugin/src/main/resources/META-INF/services/org.apache.hertzbeat.plugin.Plugin b/plugin/src/main/resources/META-INF/services/org.apache.hertzbeat.plugin.Plugin index af4bfd73bb2..8da17400556 100644 --- a/plugin/src/main/resources/META-INF/services/org.apache.hertzbeat.plugin.Plugin +++ b/plugin/src/main/resources/META-INF/services/org.apache.hertzbeat.plugin.Plugin @@ -1 +1 @@ -org.apache.hertzbeat.plugin.impl.DemoPluginImpl \ No newline at end of file +org.apache.hertzbeat.plugin.impl.DemoPluginImpl diff --git a/push/src/main/resources/META-INF/spring.factories b/push/src/main/resources/META-INF/spring.factories index f95f2645b66..a433ed2b39b 100644 --- a/push/src/main/resources/META-INF/spring.factories +++ b/push/src/main/resources/META-INF/spring.factories @@ -14,4 +14,4 @@ # limitations under the License. org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.hertzbeat.push.config.PushAutoConfiguration \ No newline at end of file +org.apache.hertzbeat.push.config.PushAutoConfiguration diff --git a/remoting/src/main/java/org/apache/hertzbeat/remoting/RemotingServer.java b/remoting/src/main/java/org/apache/hertzbeat/remoting/RemotingServer.java index 0927e441423..35fdd1d48fd 100644 --- a/remoting/src/main/java/org/apache/hertzbeat/remoting/RemotingServer.java +++ b/remoting/src/main/java/org/apache/hertzbeat/remoting/RemotingServer.java @@ -51,5 +51,9 @@ public interface RemotingServer extends RemotingService { */ ClusterMsg.Message sendMsgSync(Channel channel, ClusterMsg.Message request, int timeoutMillis); + /** + * register hook. + * @param nettyHookList hook list + */ void registerHook(List nettyHookList); } diff --git a/script/docker/server/README.md b/script/docker/server/README.md index 4cfc50fcddb..df4aca922c1 100644 --- a/script/docker/server/README.md +++ b/script/docker/server/README.md @@ -25,5 +25,4 @@ $ docker buildx build --platform linux/arm64,linux/amd64 -t quay.io/tancloud/her # Inspect the image info $ docker buildx imagetools inspect apache/hertzbeat:v1.0.0 - ``` diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/dao/HistoryDao.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/dao/HistoryDao.java index 7fb60c2f637..d00bec8e4ff 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/dao/HistoryDao.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/dao/HistoryDao.java @@ -17,7 +17,6 @@ package org.apache.hertzbeat.warehouse.dao; - import org.apache.hertzbeat.common.entity.warehouse.History; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/listener/WareHouseApplicationReadyListener.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/listener/WareHouseApplicationReadyListener.java index a611358b535..ba7501071c7 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/listener/WareHouseApplicationReadyListener.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/listener/WareHouseApplicationReadyListener.java @@ -24,10 +24,8 @@ import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; - - /** - * + * WareHouseApplicationReadyListener */ @Slf4j @Component diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataReader.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataReader.java index c8250262bba..b98a6e0f8bd 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataReader.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataReader.java @@ -22,7 +22,7 @@ import org.apache.hertzbeat.common.entity.dto.Value; /** - * + * history data reader */ public interface HistoryDataReader { diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataWriter.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataWriter.java index e606886a72a..6ea065bb178 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataWriter.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/HistoryDataWriter.java @@ -20,7 +20,7 @@ import org.apache.hertzbeat.common.entity.message.CollectRep; /** - * + * history data writer */ public interface HistoryDataWriter { diff --git a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterDataStorage.java b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterDataStorage.java index 4a779c71584..cd25dd1f748 100644 --- a/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterDataStorage.java +++ b/warehouse/src/main/java/org/apache/hertzbeat/warehouse/store/history/vm/VictoriaMetricsClusterDataStorage.java @@ -17,7 +17,6 @@ package org.apache.hertzbeat.warehouse.store.history.vm; - import com.fasterxml.jackson.databind.JsonNode; import java.math.BigDecimal; import java.math.RoundingMode; @@ -59,7 +58,6 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; - /** * tdengine data storage */ diff --git a/warehouse/src/main/resources/META-INF/spring.factories b/warehouse/src/main/resources/META-INF/spring.factories index f155fb8251a..2df923ea4c1 100644 --- a/warehouse/src/main/resources/META-INF/spring.factories +++ b/warehouse/src/main/resources/META-INF/spring.factories @@ -14,4 +14,4 @@ # limitations under the License. org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.hertzbeat.warehouse.WarehouseAutoConfiguration \ No newline at end of file +org.apache.hertzbeat.warehouse.WarehouseAutoConfiguration diff --git a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MemoryDataStorageTest.java b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MemoryDataStorageTest.java index ba3a206621b..da0e1f4dfc1 100644 --- a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MemoryDataStorageTest.java +++ b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MemoryDataStorageTest.java @@ -37,4 +37,4 @@ void getCurrentMetricsData() { @Test void destroy() { } -} \ No newline at end of file +} diff --git a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MetricsDataRedisCodecTest.java b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MetricsDataRedisCodecTest.java index dd265d8d682..b42fe9dff68 100644 --- a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MetricsDataRedisCodecTest.java +++ b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/MetricsDataRedisCodecTest.java @@ -45,4 +45,4 @@ void encodeKey() { @Test void encodeValue() { } -} \ No newline at end of file +} diff --git a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/RedisDataStorageTest.java b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/RedisDataStorageTest.java index 2beae5064ec..163a26ccd4d 100644 --- a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/RedisDataStorageTest.java +++ b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/RedisDataStorageTest.java @@ -37,4 +37,4 @@ void getCurrentMetricsData() { @Test void destroy() { } -} \ No newline at end of file +} diff --git a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/TdEngineDataStorageTest.java b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/TdEngineDataStorageTest.java index dc1cfdef22a..15ac3155154 100644 --- a/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/TdEngineDataStorageTest.java +++ b/warehouse/src/test/java/org/apache/hertzbeat/warehouse/store/TdEngineDataStorageTest.java @@ -49,4 +49,4 @@ void getHistoryMetricData() { @Test void getHistoryIntervalMetricData() { } -} \ No newline at end of file +}