This is an automated email from the ASF dual-hosted git repository.
asxing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 34ebe93 [type: refactor] refactor some warning code (#2444)
34ebe93 is described below
commit 34ebe9330db8cf1df1d742db9401e18a733ffddf
Author: xiaoyu <[email protected]>
AuthorDate: Wed Nov 24 14:15:49 2021 +0800
[type: refactor] refactor some warning code (#2444)
* [type: refactor] refactor some warning code
* [type: refactor] refactor some warning code
---
.../algorithm/AbstractRateLimiterAlgorithm.java | 20 ++++++++++----------
.../handler/RateLimiterPluginDataHandler.java | 2 +-
.../ZookeeperInstanceRegisterRepository.java | 4 ++--
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git
a/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/algorithm/AbstractRateLimiterAlgorithm.java
b/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/algorithm/AbstractRateLimiterAlgorithm.java
index 2ecf3c3..0d3a563 100644
---
a/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/algorithm/AbstractRateLimiterAlgorithm.java
+++
b/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/algorithm/AbstractRateLimiterAlgorithm.java
@@ -31,10 +31,11 @@ import java.util.List;
*/
public abstract class AbstractRateLimiterAlgorithm implements
RateLimiterAlgorithm<List<Long>> {
- private String scriptName;
-
- private RedisScript<List<Long>> script;
+ private final String scriptName;
+ private final RedisScript<List<Long>> script;
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
public AbstractRateLimiterAlgorithm(final String scriptName) {
DefaultRedisScript redisScript = new DefaultRedisScript<>();
String scriptPath = Constants.SCRIPT_PATH + scriptName;
@@ -43,12 +44,7 @@ public abstract class AbstractRateLimiterAlgorithm
implements RateLimiterAlgorit
this.script = redisScript;
this.scriptName = scriptName;
}
-
- @Override
- public String getScriptName() {
- return scriptName;
- }
-
+
/**
* Gets key name.
*
@@ -57,7 +53,11 @@ public abstract class AbstractRateLimiterAlgorithm
implements RateLimiterAlgorit
protected abstract String getKeyName();
@Override
- @SuppressWarnings({"unchecked", "rawtypes"})
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ @Override
public RedisScript<List<Long>> getScript() {
return script;
}
diff --git
a/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java
b/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java
index ab8acfa..71f0a41 100644
---
a/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java
+++
b/shenyu-plugin/shenyu-plugin-ratelimiter/src/main/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandler.java
@@ -58,7 +58,7 @@ import java.util.function.Supplier;
*/
public class RateLimiterPluginDataHandler implements PluginDataHandler {
- public static final Supplier<CommonHandleCache<String, RateLimiterHandle>>
CACHED_HANDLE = new BeanHolder(CommonHandleCache::new);
+ public static final Supplier<CommonHandleCache<String, RateLimiterHandle>>
CACHED_HANDLE = new BeanHolder<>(CommonHandleCache::new);
@Override
public void handlerPlugin(final PluginData pluginData) {
diff --git
a/shenyu-register-center/shenyu-register-instance/shenyu-register-instance-zookeeper/src/main/java/org/apache/shenyu/register/instance/zookeeper/ZookeeperInstanceRegisterRepository.java
b/shenyu-register-center/shenyu-register-instance/shenyu-register-instance-zookeeper/src/main/java/org/apache/shenyu/register/instance/zookeeper/ZookeeperInstanceRegisterRepository.java
index 94d34d7..32f8db1 100644
---
a/shenyu-register-center/shenyu-register-instance/shenyu-register-instance-zookeeper/src/main/java/org/apache/shenyu/register/instance/zookeeper/ZookeeperInstanceRegisterRepository.java
+++
b/shenyu-register-center/shenyu-register-instance/shenyu-register-instance-zookeeper/src/main/java/org/apache/shenyu/register/instance/zookeeper/ZookeeperInstanceRegisterRepository.java
@@ -57,7 +57,7 @@ public class ZookeeperInstanceRegisterRepository implements
ShenyuInstanceRegist
@Override
public void persistInstance(final InstanceRegisterDTO instance) {
- String uriNodeName = buildURINodeName(instance);
+ String uriNodeName = buildInstanceNodeName(instance);
String instancePath = RegisterPathConstants.buildInstanceParentPath();
if (!zkClient.exists(instancePath)) {
zkClient.createPersistent(instancePath, true);
@@ -75,7 +75,7 @@ public class ZookeeperInstanceRegisterRepository implements
ShenyuInstanceRegist
zkClient.close();
}
- private String buildURINodeName(final InstanceRegisterDTO instance) {
+ private String buildInstanceNodeName(final InstanceRegisterDTO instance) {
String host = instance.getHost();
int port = instance.getPort();
return String.join(Constants.COLONS, host, Integer.toString(port));