This is an automated email from the ASF dual-hosted git repository.
haiboduan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 9d96e2b41 refactor some no need code (#4893)
9d96e2b41 is described below
commit 9d96e2b41a8fed7cb61a2036b306c351ea4b6078
Author: xiaoyu <[email protected]>
AuthorDate: Mon Jul 24 15:56:16 2023 +0800
refactor some no need code (#4893)
---
.../shenyu/admin/discovery/DiscoveryLevel.java | 22 +++++++++++++++++++---
.../shenyu/admin/discovery/DiscoveryMode.java | 15 +++++++++++++++
.../shenyu/common/utils/UpstreamCheckUtils.java | 2 +-
.../apache/shenyu/common/utils/VersionUtils.java | 16 ++++++++--------
.../httpclient/AbstractHttpClientPlugin.java | 8 --------
.../shenyu-plugin-logging-clickhouse/pom.xml | 6 ------
6 files changed, 43 insertions(+), 26 deletions(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryLevel.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryLevel.java
index ccc64ac69..6449e0cba 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryLevel.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryLevel.java
@@ -17,16 +17,32 @@
package org.apache.shenyu.admin.discovery;
+/**
+ * The enum Discovery level.
+ */
public enum DiscoveryLevel {
-
- GLOBAL("2"), PLUGIN("1"), SELECTOR("0");
+
+ /**
+ * Global discovery level.
+ */
+ GLOBAL("2"),
+
+ /**
+ * Plugin discovery level.
+ */
+ PLUGIN("1"),
+
+ /**
+ * Selector discovery level.
+ */
+ SELECTOR("0");
private final String code;
DiscoveryLevel(final String code) {
this.code = code;
}
-
+
/**
* getCode.
*
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryMode.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryMode.java
index 8c0175321..c610d9ac7 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryMode.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryMode.java
@@ -17,9 +17,24 @@
package org.apache.shenyu.admin.discovery;
+/**
+ * The enum Discovery mode.
+ */
public enum DiscoveryMode {
+ /**
+ * Local discovery mode.
+ */
LOCAL,
+ /**
+ * Zookeeper discovery mode.
+ */
ZOOKEEPER,
+ /**
+ * Nacos discovery mode.
+ */
NACOS,
+ /**
+ * Eureka discovery mode.
+ */
EUREKA
}
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/UpstreamCheckUtils.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/UpstreamCheckUtils.java
index 0ac0f6af0..bb16da853 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/UpstreamCheckUtils.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/UpstreamCheckUtils.java
@@ -78,7 +78,7 @@ public class UpstreamCheckUtils {
try (Socket socket = new Socket()) {
socket.connect(new InetSocketAddress(host, port), timeout);
} catch (Exception e) {
- LOG.error("socket connect is error. host:{} port:{} timeout:{}
error:{}", host, port, timeout, e);
+ LOG.error("socket connect is error. host:{} port:{} timeout:{}",
host, port, timeout, e);
return false;
}
return true;
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/VersionUtils.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/VersionUtils.java
index c3ce365db..f6f03d3c9 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/VersionUtils.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/VersionUtils.java
@@ -17,16 +17,16 @@
package org.apache.shenyu.common.utils;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.net.URL;
import java.security.CodeSource;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
/**
* VersionUtils.
@@ -102,7 +102,7 @@ public final class VersionUtils {
}
/**
- * checkDuplicate,this method refers to the design of
dubbo,url:https://dubbo.apache.org/zh/docs/v2.7/dev/principals/dummy/ .
+ * checkDuplicate,this method refers to the design of dubbo .
* @param cls cls
*/
public static void checkDuplicate(final Class<?> cls) {
@@ -115,7 +115,7 @@ public final class VersionUtils {
LOG.error("checkDuplicate error,{}", error);
}
} catch (Throwable e) {
- LOG.error("checkDuplicate error,msg={},e={}", e.getMessage(), e);
+ LOG.error("checkDuplicate error,msg :{}", e.getMessage(), e);
}
}
@@ -128,7 +128,7 @@ public final class VersionUtils {
*/
private static Set<String> readResources(final String path, final Class<?>
cls) throws IOException {
Enumeration<URL> urls = cls.getClassLoader().getResources(path);
- Set<String> files = new HashSet<String>();
+ Set<String> files = new HashSet<>();
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
if (url != null) {
diff --git
a/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java
b/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java
index 8e2064d7d..12b7291f5 100644
---
a/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java
+++
b/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java
@@ -57,7 +57,6 @@ import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
/**
* The type abstract http client plugin.
@@ -170,13 +169,6 @@ public abstract class AbstractHttpClientPlugin<R>
implements ShenyuPlugin {
private HttpHeaders buildHttpHeaders(final ServerWebExchange exchange) {
final HttpHeaders headers = new HttpHeaders();
headers.addAll(exchange.getRequest().getHeaders());
- // remove gzip
- List<String> acceptEncoding = headers.get(HttpHeaders.ACCEPT_ENCODING);
- if (CollectionUtils.isNotEmpty(acceptEncoding)) {
- acceptEncoding = Stream.of(String.join(",",
acceptEncoding).split(",")).collect(Collectors.toList());
- acceptEncoding.remove(Constants.HTTP_ACCEPT_ENCODING_GZIP);
- headers.set(HttpHeaders.ACCEPT_ENCODING, String.join(",",
acceptEncoding));
- }
headers.remove(HttpHeaders.HOST);
return headers;
}
diff --git
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-clickhouse/pom.xml
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-clickhouse/pom.xml
index c17876950..6426b4335 100644
---
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-clickhouse/pom.xml
+++
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-clickhouse/pom.xml
@@ -39,12 +39,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>