This is an automated email from the ASF dual-hosted git repository. liujun pushed a commit to branch 3.0 in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push: new 09ba93e fix memory leak of waitForRemove attribute (#7119) 09ba93e is described below commit 09ba93e937c952af6897e482446ee9793e1e5f75 Author: Wu Zhiguo <wzg547228...@gmail.com> AuthorDate: Sat Jan 23 15:42:21 2021 +0800 fix memory leak of waitForRemove attribute (#7119) fix #7118 --- .../apache/dubbo/registry/support/CacheableFailbackRegistry.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java index e5f2a34..ace03c2 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java @@ -306,8 +306,11 @@ public abstract class CacheableFailbackRegistry extends FailbackRegistry { } } - if (semaphore.tryAcquire() && CollectionUtils.isNotEmptyMap(waitForRemove)) {//move to next schedule - cacheRemovalScheduler.schedule(new RemovalTask(), cacheRemovalTaskIntervalInMillis, TimeUnit.MILLISECONDS); + if (CollectionUtils.isNotEmptyMap(waitForRemove)) { + // move to next schedule + if (semaphore.tryAcquire()) { + cacheRemovalScheduler.schedule(new RemovalTask(), cacheRemovalTaskIntervalInMillis, TimeUnit.MILLISECONDS); + } } } }