Merge pull request #1374 from zhaoyuguang/study

All overriding methods must be preceded by @Override annotations.
This commit is contained in:
Fury Zhu 2019-06-18 11:33:02 +08:00 committed by GitHub
commit d5873a21e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 55 additions and 1 deletions

View File

@ -193,6 +193,7 @@ public abstract class AbstractHealthChecker implements Cloneable {
}
@Override
public Tcp clone() throws CloneNotSupportedException {
Tcp config = new Tcp();
config.setType(this.type);

View File

@ -426,6 +426,7 @@ public class ServerHttpAgent implements HttpAgent {
return code;
}
@Override
public String toString() {
return "STSCredential{" +
"accessKeyId='" + accessKeyId + '\'' +

View File

@ -168,7 +168,6 @@ public class CacheData {
final Listener listener = listenerWrap.listener;
Runnable job = new Runnable() {
@Override
public void run() {
ClassLoader myClassLoader = Thread.currentThread().getContextClassLoader();

View File

@ -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");

View File

@ -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()) {

View File

@ -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;
}

View File

@ -212,6 +212,7 @@ public class FailoverReactor {
}
class DiskFileWriter extends TimerTask {
@Override
public void run() {
Map<String, ServiceInfo> map = hostReactor.getServiceInfoMap();
for (Map.Entry<String, ServiceInfo> entry : map.entrySet()) {

View File

@ -31,10 +31,12 @@ public class GenericPoller<T> implements Poller<T> {
this.items = items;
}
@Override
public T next() {
return items.get(Math.abs(index.getAndIncrement() % items.size()));
}
@Override
public Poller<T> refresh(List<T> items) {
return new GenericPoller<T>(items);
}

View File

@ -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 <code>n &lt;= 0</code>
*/
@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();
}

View File

@ -146,6 +146,7 @@ public class ThreadLocalRandom extends Random {
* The actual ThreadLocal
*/
private static final ThreadLocal<ThreadLocalRandom> localRandom = new ThreadLocal<ThreadLocalRandom>() {
@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));

View File

@ -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()) {

View File

@ -94,6 +94,7 @@ public class ConfigInfoBase implements Serializable, Comparable<ConfigInfoBase>
writer.write(this.content);
}
@Override
public int compareTo(ConfigInfoBase o) {
if (o == null) {
return 1;

View File

@ -54,6 +54,7 @@ public class GroupKey extends GroupKey2 {
this.group = group;
}
@Override
public String toString() {
return dataId + "+" + group;
}

View File

@ -32,6 +32,7 @@ public class DynamicDataSource implements ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}

View File

@ -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());

View File

@ -94,6 +94,7 @@ public class PersistService {
static final class ConfigInfoWrapperRowMapper implements
RowMapper<ConfigInfoWrapper> {
@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<ConfigInfoBetaWrapper> {
@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<ConfigInfoTagWrapper> {
@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<ConfigInfo> {
@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<ConfigKey> {
@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<ConfigAdvanceInfo> {
@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<ConfigAllInfo> {
@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<ConfigInfo4Beta> {
@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<ConfigInfo4Tag> {
@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<ConfigInfoBase> {
@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<ConfigInfoAggr> {
@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<ConfigInfoChanged> {
@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<ConfigHistoryInfo> {
@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<ConfigHistoryInfo> {
@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<TenantInfo> {
@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<User> {
@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());

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();

View File

@ -143,6 +143,7 @@ public class RsInfo {
this.metadata = metadata;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}

View File

@ -73,6 +73,7 @@ public class OverrideParameterRequestWrapper extends HttpServletRequestWrapper {
return params;
}
@Override
public String[] getParameterValues(String name) {
return params.get(name);
}