From 10aa620315c1d6a61224b8b4efeeba86eac49b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E7=A6=B9=E5=85=89?= Date: Fri, 14 Jun 2019 18:54:04 +0800 Subject: [PATCH] All overriding methods must be preceded by @Override annotations. --- .../naming/pojo/AbstractHealthChecker.java | 1 + .../client/config/http/ServerHttpAgent.java | 1 + .../nacos/client/config/impl/CacheData.java | 1 + .../client/config/impl/TimerService.java | 1 + .../client/identify/CredentialService.java | 1 + .../nacos/client/identify/Credentials.java | 2 ++ .../naming/backups/FailoverReactor.java | 1 + .../client/naming/utils/GenericPoller.java | 2 ++ .../nacos/client/naming/utils/JvmRandom.java | 9 +++++++++ .../naming/utils/ThreadLocalRandom.java | 3 +++ .../config/server/manager/TaskManager.java | 2 ++ .../config/server/model/ConfigInfoBase.java | 1 + .../config/server/model/app/GroupKey.java | 1 + .../server/service/DynamicDataSource.java | 1 + .../server/service/LongPollingService.java | 1 + .../config/server/service/PersistService.java | 19 +++++++++++++++++++ .../service/notify/AsyncNotifyService.java | 2 ++ .../config/server/utils/SimpleFlowData.java | 2 ++ .../config/server/utils/SimpleIPFlowData.java | 2 ++ .../alibaba/nacos/naming/core/Service.java | 1 + .../nacos/naming/healthcheck/RsInfo.java | 1 + .../web/OverrideParameterRequestWrapper.java | 1 + 22 files changed, 56 insertions(+) diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java index 182c229e9..f719c7d76 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java @@ -193,6 +193,7 @@ public abstract class AbstractHealthChecker implements Cloneable { } + @Override public Tcp clone() throws CloneNotSupportedException { Tcp config = new Tcp(); config.setType(this.type); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java index aa2bf35ef..094393edd 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/http/ServerHttpAgent.java @@ -426,6 +426,7 @@ public class ServerHttpAgent implements HttpAgent { return code; } + @Override public String toString() { return "STSCredential{" + "accessKeyId='" + accessKeyId + '\'' + diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java index 47c1d262d..f59462753 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java @@ -167,6 +167,7 @@ public class CacheData { final Listener listener = listenerWrap.listener; Runnable job = new Runnable() { + @Override public void run() { ClassLoader myClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader appClassLoader = listener.getClass().getClassLoader(); diff --git a/client/src/main/java/com/alibaba/nacos/client/config/impl/TimerService.java b/client/src/main/java/com/alibaba/nacos/client/config/impl/TimerService.java index 88e828ae0..5b0ceaf00 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/impl/TimerService.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/impl/TimerService.java @@ -36,6 +36,7 @@ public class TimerService { @SuppressWarnings("PMD.ThreadPoolCreationRule") static ScheduledExecutorService scheduledExecutor = Executors .newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("com.alibaba.nacos.client.Timer"); diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java index cb1c39e85..4ce6edb67 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/CredentialService.java @@ -85,6 +85,7 @@ public final class CredentialService implements SpasCredentialLoader { LOGGER.info("[{}] {} is freed", appName, this.getClass().getSimpleName()); } + @Override public Credentials getCredential() { Credentials localCredential = credentials; if (localCredential.valid()) { diff --git a/client/src/main/java/com/alibaba/nacos/client/identify/Credentials.java b/client/src/main/java/com/alibaba/nacos/client/identify/Credentials.java index 36f698c95..5f865cc5e 100644 --- a/client/src/main/java/com/alibaba/nacos/client/identify/Credentials.java +++ b/client/src/main/java/com/alibaba/nacos/client/identify/Credentials.java @@ -38,6 +38,7 @@ public class Credentials implements SpasCredential { this(null, null, null); } + @Override public String getAccessKey() { return accessKey; } @@ -46,6 +47,7 @@ public class Credentials implements SpasCredential { this.accessKey = accessKey; } + @Override public String getSecretKey() { return secretKey; } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java index 88b0ff30c..052a0e8fa 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/backups/FailoverReactor.java @@ -212,6 +212,7 @@ public class FailoverReactor { } class DiskFileWriter extends TimerTask { + @Override public void run() { Map map = hostReactor.getServiceInfoMap(); for (Map.Entry entry : map.entrySet()) { diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java index 08e302b00..e5e40930d 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/GenericPoller.java @@ -31,10 +31,12 @@ public class GenericPoller implements Poller { this.items = items; } + @Override public T next() { return items.get(Math.abs(index.getAndIncrement() % items.size())); } + @Override public Poller refresh(List items) { return new GenericPoller(items); } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/JvmRandom.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/JvmRandom.java index b9c9092a1..362c1747c 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/JvmRandom.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/JvmRandom.java @@ -63,6 +63,7 @@ public final class JvmRandom extends Random { * @param seed ignored * @throws UnsupportedOperationException */ + @Override public synchronized void setSeed(long seed) { if (this.constructed) { throw new UnsupportedOperationException(); @@ -75,6 +76,7 @@ public final class JvmRandom extends Random { * @return Nothing, this method always throws an UnsupportedOperationException. * @throws UnsupportedOperationException */ + @Override public synchronized double nextGaussian() { throw new UnsupportedOperationException(); } @@ -85,6 +87,7 @@ public final class JvmRandom extends Random { * @param byteArray ignored * @throws UnsupportedOperationException */ + @Override public void nextBytes(byte[] byteArray) { throw new UnsupportedOperationException(); } @@ -95,6 +98,7 @@ public final class JvmRandom extends Random { * * @return the random int */ + @Override public int nextInt() { return nextInt(Integer.MAX_VALUE); } @@ -107,6 +111,7 @@ public final class JvmRandom extends Random { * @return the random int * @throws IllegalArgumentException when n <= 0 */ + @Override public int nextInt(int n) { return SHARED_RANDOM.nextInt(n); } @@ -117,6 +122,7 @@ public final class JvmRandom extends Random { * * @return the random long */ + @Override public long nextLong() { return nextLong(Long.MAX_VALUE); } @@ -158,6 +164,7 @@ public final class JvmRandom extends Random { * * @return the random boolean */ + @Override public boolean nextBoolean() { return SHARED_RANDOM.nextBoolean(); } @@ -168,6 +175,7 @@ public final class JvmRandom extends Random { * * @return the random float */ + @Override public float nextFloat() { return SHARED_RANDOM.nextFloat(); } @@ -177,6 +185,7 @@ public final class JvmRandom extends Random { * * @return the random double */ + @Override public double nextDouble() { return SHARED_RANDOM.nextDouble(); } diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/utils/ThreadLocalRandom.java b/client/src/main/java/com/alibaba/nacos/client/naming/utils/ThreadLocalRandom.java index aec6d42a0..e141b6fff 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/utils/ThreadLocalRandom.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/utils/ThreadLocalRandom.java @@ -146,6 +146,7 @@ public class ThreadLocalRandom extends Random { * The actual ThreadLocal */ private static final ThreadLocal localRandom = new ThreadLocal() { + @Override protected ThreadLocalRandom initialValue() { return new ThreadLocalRandom(); } @@ -165,6 +166,7 @@ public class ThreadLocalRandom extends Random { * * @throws UnsupportedOperationException always */ + @Override public void setSeed(long seed) { if (initialized) { throw new UnsupportedOperationException(); @@ -172,6 +174,7 @@ public class ThreadLocalRandom extends Random { rnd = (seed ^ multiplier) & mask; } + @Override protected int next(int bits) { rnd = (rnd * multiplier + addend) & mask; return (int)(rnd >>> (48 - bits)); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManager.java b/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManager.java index d1311c02b..5bd05d58c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManager.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManager.java @@ -55,6 +55,7 @@ public final class TaskManager implements TaskManagerMBean { class ProcessRunnable implements Runnable { + @Override public void run() { while (!TaskManager.this.closed.get()) { try { @@ -248,6 +249,7 @@ public final class TaskManager implements TaskManagerMBean { } } + @Override public String getTaskInfos() { StringBuilder sb = new StringBuilder(); for (String taskType : this.taskProcessors.keySet()) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfoBase.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfoBase.java index 94cb5ef32..55151910e 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfoBase.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfoBase.java @@ -94,6 +94,7 @@ public class ConfigInfoBase implements Serializable, Comparable writer.write(this.content); } + @Override public int compareTo(ConfigInfoBase o) { if (o == null) { return 1; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/app/GroupKey.java b/config/src/main/java/com/alibaba/nacos/config/server/model/app/GroupKey.java index 287d175a5..f14e505d3 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/model/app/GroupKey.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/model/app/GroupKey.java @@ -54,6 +54,7 @@ public class GroupKey extends GroupKey2 { this.group = group; } + @Override public String toString() { return dataId + "+" + group; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/DynamicDataSource.java b/config/src/main/java/com/alibaba/nacos/config/server/service/DynamicDataSource.java index 90f9cd2cd..ac8fe8bb4 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/DynamicDataSource.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/DynamicDataSource.java @@ -36,6 +36,7 @@ public class DynamicDataSource implements ApplicationContextAware { private ApplicationContext applicationContext; + @Override public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java index ec8ae8fff..b24c873e0 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/LongPollingService.java @@ -371,6 +371,7 @@ public class LongPollingService extends AbstractEventListener { @Override public void run() { asyncTimeoutFuture = scheduler.schedule(new Runnable() { + @Override public void run() { try { getRetainIps().put(ClientLongPolling.this.ip, System.currentTimeMillis()); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java index 7e1429d67..60ea7ce41 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java @@ -94,6 +94,7 @@ public class PersistService { static final class ConfigInfoWrapperRowMapper implements RowMapper { + @Override public ConfigInfoWrapper mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoWrapper info = new ConfigInfoWrapper(); @@ -128,6 +129,7 @@ public class PersistService { static final class ConfigInfoBetaWrapperRowMapper implements RowMapper { + @Override public ConfigInfoBetaWrapper mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoBetaWrapper info = new ConfigInfoBetaWrapper(); @@ -163,6 +165,7 @@ public class PersistService { static final class ConfigInfoTagWrapperRowMapper implements RowMapper { + @Override public ConfigInfoTagWrapper mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoTagWrapper info = new ConfigInfoTagWrapper(); @@ -198,6 +201,7 @@ public class PersistService { static final class ConfigInfoRowMapper implements RowMapper { + @Override public ConfigInfo mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfo info = new ConfigInfo(); @@ -227,6 +231,7 @@ public class PersistService { static final class ConfigKeyRowMapper implements RowMapper { + @Override public ConfigKey mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigKey info = new ConfigKey(); @@ -239,6 +244,7 @@ public class PersistService { } static final class ConfigAdvanceInfoRowMapper implements RowMapper { + @Override public ConfigAdvanceInfo mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigAdvanceInfo info = new ConfigAdvanceInfo(); info.setCreateTime(rs.getTimestamp("gmt_modified").getTime()); @@ -255,6 +261,7 @@ public class PersistService { } static final class ConfigAllInfoRowMapper implements RowMapper { + @Override public ConfigAllInfo mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigAllInfo info = new ConfigAllInfo(); info.setDataId(rs.getString("data_id")); @@ -291,6 +298,7 @@ public class PersistService { static final class ConfigInfo4BetaRowMapper implements RowMapper { + @Override public ConfigInfo4Beta mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfo4Beta info = new ConfigInfo4Beta(); @@ -320,6 +328,7 @@ public class PersistService { static final class ConfigInfo4TagRowMapper implements RowMapper { + @Override public ConfigInfo4Tag mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfo4Tag info = new ConfigInfo4Tag(); @@ -349,6 +358,7 @@ public class PersistService { static final class ConfigInfoBaseRowMapper implements RowMapper { + @Override public ConfigInfoBase mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoBase info = new ConfigInfoBase(); @@ -371,6 +381,7 @@ public class PersistService { static final class ConfigInfoAggrRowMapper implements RowMapper { + @Override public ConfigInfoAggr mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoAggr info = new ConfigInfoAggr(); @@ -385,6 +396,7 @@ public class PersistService { } static final class ConfigInfoChangedRowMapper implements RowMapper { + @Override public ConfigInfoChanged mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigInfoChanged info = new ConfigInfoChanged(); info.setDataId(rs.getString("data_id")); @@ -395,6 +407,7 @@ public class PersistService { } static final class ConfigHistoryRowMapper implements RowMapper { + @Override public ConfigHistoryInfo mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigHistoryInfo configHistoryInfo = new ConfigHistoryInfo(); configHistoryInfo.setId(rs.getLong("nid")); @@ -411,6 +424,7 @@ public class PersistService { } static final class ConfigHistoryDetailRowMapper implements RowMapper { + @Override public ConfigHistoryInfo mapRow(ResultSet rs, int rowNum) throws SQLException { ConfigHistoryInfo configHistoryInfo = new ConfigHistoryInfo(); configHistoryInfo.setId(rs.getLong("nid")); @@ -432,6 +446,7 @@ public class PersistService { ; static final class TenantInfoRowMapper implements RowMapper { + @Override public TenantInfo mapRow(ResultSet rs, int rowNum) throws SQLException { TenantInfo info = new TenantInfo(); info.setTenantId(rs.getString("tenant_id")); @@ -442,6 +457,7 @@ public class PersistService { } static final class UserRowMapper implements RowMapper { + @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setUsername(rs.getString("username")); @@ -799,6 +815,7 @@ public class PersistService { try { this.jt.update(sql, new PreparedStatementSetter() { + @Override public void setValues(PreparedStatement ps) throws SQLException { int index = 1; ps.setString(index++, dataId); @@ -822,6 +839,7 @@ public class PersistService { try { this.jt.update(sql, new PreparedStatementSetter() { + @Override public void setValues(PreparedStatement ps) throws SQLException { int index = 1; ps.setString(index++, dataId); @@ -2637,6 +2655,7 @@ public class PersistService { try { jt.update(new PreparedStatementCreator() { + @Override public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); ps.setString(1, configInfo.getDataId()); diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java index ee3fe7a45..d48f411d0 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/notify/AsyncNotifyService.java @@ -319,10 +319,12 @@ public class AsyncNotifyService extends AbstractEventListener { // this.executor = executor; } + @Override public void setFailCount(int count) { this.failCount = count; } + @Override public int getFailCount() { return failCount; } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleFlowData.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleFlowData.java index d795a7876..76827c1d6 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleFlowData.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleFlowData.java @@ -35,6 +35,7 @@ public class SimpleFlowData { @SuppressWarnings("PMD.ThreadPoolCreationRule") private ScheduledExecutorService timer = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("nacos flow control thread"); @@ -52,6 +53,7 @@ public class SimpleFlowData { } timer.scheduleAtFixedRate(new Runnable() { + @Override public void run() { rotateSlot(); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleIPFlowData.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleIPFlowData.java index 88e0491f1..d29a73bb6 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleIPFlowData.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/SimpleIPFlowData.java @@ -38,6 +38,7 @@ public class SimpleIPFlowData { @SuppressWarnings("PMD.ThreadPoolCreationRule") private ScheduledExecutorService timer = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("nacos ip flow control thread"); @@ -49,6 +50,7 @@ public class SimpleIPFlowData { class DefaultIPFlowDataManagerTask implements Runnable { + @Override public void run() { rotateSlot(); } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/Service.java b/naming/src/main/java/com/alibaba/nacos/naming/core/Service.java index f8512b4a8..0fcc029f7 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/Service.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/Service.java @@ -427,6 +427,7 @@ public class Service extends com.alibaba.nacos.api.naming.pojo.Service implement recalculateChecksum(); } + @Override public String getChecksum() { if (StringUtils.isEmpty(checksum)) { recalculateChecksum(); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/RsInfo.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/RsInfo.java index d64a0fbd7..95913e6a5 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/RsInfo.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/RsInfo.java @@ -143,6 +143,7 @@ public class RsInfo { this.metadata = metadata; } + @Override public String toString() { return JSON.toJSONString(this); } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/web/OverrideParameterRequestWrapper.java b/naming/src/main/java/com/alibaba/nacos/naming/web/OverrideParameterRequestWrapper.java index 3f419d9dd..65b4a1529 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/web/OverrideParameterRequestWrapper.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/web/OverrideParameterRequestWrapper.java @@ -73,6 +73,7 @@ public class OverrideParameterRequestWrapper extends HttpServletRequestWrapper { return params; } + @Override public String[] getParameterValues(String name) { return params.get(name); }