diff --git a/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyServiceImpl.java b/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyServiceImpl.java index db0625f09e82..a0918f60647b 100644 --- a/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyServiceImpl.java +++ b/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyServiceImpl.java @@ -55,9 +55,11 @@ import static com.hazelcast.internal.metrics.ProbeLevel.MANDATORY; import static com.hazelcast.internal.util.counters.MwCounter.newMwCounter; import static com.hazelcast.util.ConcurrencyUtil.getOrPutIfAbsent; -import static com.hazelcast.util.FutureUtil.logAllExceptions; +import static com.hazelcast.util.ExceptionUtil.peel; import static com.hazelcast.util.FutureUtil.waitWithDeadline; import static com.hazelcast.util.Preconditions.checkNotNull; +import static java.util.logging.Level.FINEST; +import static java.util.logging.Level.WARNING; public class ProxyServiceImpl implements InternalProxyService, PostJoinAwareService, @@ -65,8 +67,6 @@ public class ProxyServiceImpl public static final String SERVICE_NAME = "hz:core:proxyService"; - private static final ExceptionHandler DESTROY_PROXY_EXCEPTION_HANDLER = logAllExceptions(Level.WARNING); - private static final int TRY_COUNT = 10; private static final long DESTROY_TIMEOUT_SECONDS = 30; @@ -90,6 +90,15 @@ public ProxyRegistry createNew(String serviceName) { @Probe(name = "destroyedCount", level = MANDATORY) private final MwCounter destroyedCounter = newMwCounter(); + private final ExceptionHandler destroyProxyExceptionHandler = new ExceptionHandler() { + @Override + public void handleException(Throwable throwable) { + boolean causedByInactiveInstance = peel(throwable) instanceof HazelcastInstanceNotActiveException; + Level level = causedByInactiveInstance ? FINEST : WARNING; + logger.log(level, "Error while destroying a proxy.", throwable); + } + }; + public ProxyServiceImpl(NodeEngineImpl nodeEngine) { this.nodeEngine = nodeEngine; this.logger = nodeEngine.getLogger(ProxyService.class.getName()); @@ -159,7 +168,7 @@ public void destroyDistributedObject(String serviceName, String name) { destroyLocalDistributedObject(serviceName, name, true); - waitWithDeadline(calls, DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS, DESTROY_PROXY_EXCEPTION_HANDLER); + waitWithDeadline(calls, DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS, destroyProxyExceptionHandler); } public void destroyLocalDistributedObject(String serviceName, String name, boolean fireEvent) {