Skip to content

Commit

Permalink
Do not log a warning when a remote node is shutdown while destroying …
Browse files Browse the repository at this point in the history
…a proxy

Reasoning:
When a member is shutdown then it's not a big deal when a proxy was
not  destryoed. It's just a noise and it looks scary.

See hazelcast#8736
  • Loading branch information
jerrinot committed Aug 19, 2016
1 parent cfad2df commit 39486d8
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@
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,
EventPublishingService<DistributedObjectEventPacket, Object>, MetricsProvider {

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;

Expand All @@ -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());
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 39486d8

Please sign in to comment.