From 82be6ab4c8c1ce42e299366ed525bf895710330c Mon Sep 17 00:00:00 2001 From: Prudhviraj Karumanchi Date: Wed, 9 Nov 2022 10:27:01 -0800 Subject: [PATCH] don't queue tasks if queue is not empty --- .../evcache/pool/EVCacheClientPool.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/evcache-core/src/main/java/com/netflix/evcache/pool/EVCacheClientPool.java b/evcache-core/src/main/java/com/netflix/evcache/pool/EVCacheClientPool.java index b01083bb..81cafdae 100644 --- a/evcache-core/src/main/java/com/netflix/evcache/pool/EVCacheClientPool.java +++ b/evcache-core/src/main/java/com/netflix/evcache/pool/EVCacheClientPool.java @@ -1482,17 +1482,17 @@ public void refreshPool() { public void refreshPool(boolean async, boolean force) { if (log.isDebugEnabled()) log.debug("Refresh Pool : async : " + async + "; force : " + force); try { - if(async) { - asyncRefreshExecutor.submit(new Runnable() { - @Override - public void run() { - try { - refresh(force); - } catch (Exception e) { - log.error(e.getMessage(), e); + if(async && asyncRefreshExecutor.getQueue().size() == 0) { + asyncRefreshExecutor.submit(new Runnable() { + @Override + public void run() { + try { + refresh(force); + } catch (Exception e) { + log.error(e.getMessage(), e); + } } - } - }); + }); } else { refresh(force); }