replace with lambda (#7218)

This commit is contained in:
李晓双 Li Xiao Shuang 2021-11-12 10:56:54 +08:00 committed by GitHub
parent 9e1b094985
commit c6adbcaa20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -735,9 +735,7 @@ public class ClientWorker implements Closeable {
@Override @Override
public void startInternal() throws NacosException { public void startInternal() throws NacosException {
executor.schedule(new Runnable() { executor.schedule(() -> {
@Override
public void run() {
while (!executor.isShutdown() && !executor.isTerminated()) { while (!executor.isShutdown() && !executor.isTerminated()) {
try { try {
listenExecutebell.poll(5L, TimeUnit.SECONDS); listenExecutebell.poll(5L, TimeUnit.SECONDS);
@ -749,7 +747,6 @@ public class ClientWorker implements Closeable {
LOGGER.error("[ rpc listen execute ] [rpc listen] exception", e); LOGGER.error("[ rpc listen execute ] [rpc listen] exception", e);
} }
} }
}
}, 0L, TimeUnit.MILLISECONDS); }, 0L, TimeUnit.MILLISECONDS);
} }
@ -788,7 +785,7 @@ public class ClientWorker implements Closeable {
if (!cache.isUseLocalConfigInfo()) { if (!cache.isUseLocalConfigInfo()) {
List<CacheData> cacheDatas = listenCachesMap.get(String.valueOf(cache.getTaskId())); List<CacheData> cacheDatas = listenCachesMap.get(String.valueOf(cache.getTaskId()));
if (cacheDatas == null) { if (cacheDatas == null) {
cacheDatas = new LinkedList<CacheData>(); cacheDatas = new LinkedList<>();
listenCachesMap.put(String.valueOf(cache.getTaskId()), cacheDatas); listenCachesMap.put(String.valueOf(cache.getTaskId()), cacheDatas);
} }
cacheDatas.add(cache); cacheDatas.add(cache);
@ -799,7 +796,7 @@ public class ClientWorker implements Closeable {
if (!cache.isUseLocalConfigInfo()) { if (!cache.isUseLocalConfigInfo()) {
List<CacheData> cacheDatas = removeListenCachesMap.get(String.valueOf(cache.getTaskId())); List<CacheData> cacheDatas = removeListenCachesMap.get(String.valueOf(cache.getTaskId()));
if (cacheDatas == null) { if (cacheDatas == null) {
cacheDatas = new LinkedList<CacheData>(); cacheDatas = new LinkedList<>();
removeListenCachesMap.put(String.valueOf(cache.getTaskId()), cacheDatas); removeListenCachesMap.put(String.valueOf(cache.getTaskId()), cacheDatas);
} }
cacheDatas.add(cache); cacheDatas.add(cache);