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,19 +735,16 @@ public class ClientWorker implements Closeable {
@Override @Override
public void startInternal() throws NacosException { public void startInternal() throws NacosException {
executor.schedule(new Runnable() { executor.schedule(() -> {
@Override while (!executor.isShutdown() && !executor.isTerminated()) {
public void run() { try {
while (!executor.isShutdown() && !executor.isTerminated()) { listenExecutebell.poll(5L, TimeUnit.SECONDS);
try { if (executor.isShutdown() || executor.isTerminated()) {
listenExecutebell.poll(5L, TimeUnit.SECONDS); continue;
if (executor.isShutdown() || executor.isTerminated()) {
continue;
}
executeConfigListen();
} catch (Exception e) {
LOGGER.error("[ rpc listen execute ] [rpc listen] exception", e);
} }
executeConfigListen();
} catch (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);