<E extends Throwable> E defunct(E e) { if (isDefunct.compareAndSet(false, true)) { if (Host.statesLogger.isTraceEnabled()) Host.statesLogger.trace("Defuncting " + this, e); else if (Host.statesLogger.isDebugEnabled()) Host.statesLogger.debug("Defuncting {} because: {}", this, e.getMessage()); Host host = factory.manager.metadata.getHost(address); if (host != null) { // Sometimes close() can be called before defunct(); avoid decrementing the connection count // twice, but // we still want to signal the error to the conviction policy. boolean decrement = signaled.compareAndSet(false, true); boolean hostDown = host.convictionPolicy.signalConnectionFailure(this, decrement); if (hostDown) { factory.manager.signalHostDown(host, host.wasJustAdded()); } else { notifyOwnerWhenDefunct(); } } // Force the connection to close to make sure the future completes. Otherwise force() might // never get called and // threads will wait on the future forever. // (this also errors out pending handlers) closeAsync().force(); } return e; }
<E extends Exception> E defunct(E e) { if (isDefunct.compareAndSet(false, true)) { if (Host.statesLogger.isTraceEnabled()) Host.statesLogger.trace("Defuncting " + this, e); else if (Host.statesLogger.isDebugEnabled()) Host.statesLogger.debug("Defuncting {} because: {}", this, e.getMessage()); Host host = factory.manager.metadata.getHost(address); if (host != null) { // Sometimes close() can be called before defunct(); avoid decrementing the connection count twice, but // we still want to signal the error to the conviction policy. boolean decrement = signaled.compareAndSet(false, true); boolean hostDown = host.convictionPolicy.signalConnectionFailure(this, decrement); if (hostDown) { factory.manager.signalHostDown(host, host.wasJustAdded()); } else { notifyOwnerWhenDefunct(); } } // Force the connection to close to make sure the future completes. Otherwise force() might never get called and // threads will wait on the future forever. // (this also errors out pending handlers) closeAsync().force(); } return e; }
<E extends Exception> E defunct(E e) { if (isDefunct.compareAndSet(false, true)) { if (Host.statesLogger.isTraceEnabled()) Host.statesLogger.trace("Defuncting " + this, e); else if (Host.statesLogger.isDebugEnabled()) Host.statesLogger.debug("Defuncting {} because: {}", this, e.getMessage()); Host host = factory.manager.metadata.getHost(address); if (host != null) { // Sometimes close() can be called before defunct(); avoid decrementing the connection count twice, but // we still want to signal the error to the conviction policy. boolean decrement = signaled.compareAndSet(false, true); boolean hostDown = host.convictionPolicy.signalConnectionFailure(this, decrement); if (hostDown) { factory.manager.signalHostDown(host, host.wasJustAdded()); } else { notifyOwnerWhenDefunct(); } } // Force the connection to close to make sure the future completes. Otherwise force() might never get called and // threads will wait on the future forever. // (this also errors out pending handlers) closeAsync().force(); } return e; }
<E extends Exception> E defunct(E e) { if (isDefunct.compareAndSet(false, true)) { if (Host.statesLogger.isTraceEnabled()) Host.statesLogger.trace("Defuncting " + this, e); else if (Host.statesLogger.isDebugEnabled()) Host.statesLogger.debug("Defuncting {} because: {}", this, e.getMessage()); Host host = factory.manager.metadata.getHost(address); if (host != null) { // Sometimes close() can be called before defunct(); avoid decrementing the connection count twice, but // we still want to signal the error to the conviction policy. boolean decrement = signaled.compareAndSet(false, true); boolean hostDown = host.convictionPolicy.signalConnectionFailure(this, decrement); if (hostDown) { factory.manager.signalHostDown(host, host.wasJustAdded()); } else { notifyOwnerWhenDefunct(); } } // Force the connection to close to make sure the future completes. Otherwise force() might never get called and // threads will wait on the future forever. // (this also errors out pending handlers) closeAsync().force(); } return e; }