private void log(final Method method, final boolean isFailover, final int failovers, final long delay, final Exception ex) { // log info if this has made some successful calls or // this is not the first failover final boolean info = hasSuccessfulCall || failovers != 0 || asyncCallHandler.hasSuccessfulCall(); if (!info && !LOG.isDebugEnabled()) { return; } final StringBuilder b = new StringBuilder() .append(ex + ", while invoking ") .append(proxyDescriptor.getProxyInfo().getString(method.getName())); if (failovers > 0) { b.append(" after ").append(failovers).append(" failover attempts"); } b.append(isFailover? ". Trying to failover ": ". Retrying "); b.append(delay > 0? "after sleeping for " + delay + "ms.": "immediately."); if (info) { LOG.info(b.toString()); } else { LOG.debug(b.toString(), ex); } }
private RetryInfo handleException(final Method method, final int callId, final RetryPolicy policy, final Counters counters, final long expectFailoverCount, final Exception e) throws Exception { final RetryInfo retryInfo = RetryInfo.newRetryInfo(policy, e, counters, proxyDescriptor.idempotentOrAtMostOnce(method), expectFailoverCount); if (retryInfo.isFail()) { // fail. if (retryInfo.action.reason != null) { if (LOG.isDebugEnabled()) { LOG.debug("Exception while invoking call #" + callId + " " + proxyDescriptor.getProxyInfo().getString(method.getName()) + ". Not retrying because " + retryInfo.action.reason, e); } } throw retryInfo.getFailException(); } log(method, retryInfo.isFailover(), counters.failovers, retryInfo.delay, e); return retryInfo; }
private void log(final Method method, final boolean isFailover, final int failovers, final long delay, final Exception ex) { // log info if this has made some successful calls or // this is not the first failover final boolean info = hasSuccessfulCall || failovers != 0 || asyncCallHandler.hasSuccessfulCall(); if (!info && !LOG.isDebugEnabled()) { return; } final StringBuilder b = new StringBuilder() .append("Exception while invoking ") .append(proxyDescriptor.getProxyInfo().getString(method.getName())); if (failovers > 0) { b.append(" after ").append(failovers).append(" failover attempts"); } b.append(isFailover? ". Trying to failover ": ". Retrying "); b.append(delay > 0? "after sleeping for " + delay + "ms.": "immediately."); if (info) { LOG.info(b.toString(), ex); } else { LOG.debug(b.toString(), ex); } }
private RetryInfo handleException(final Method method, final int callId, final RetryPolicy policy, final Counters counters, final long expectFailoverCount, final Exception e) throws Exception { final RetryInfo retryInfo = RetryInfo.newRetryInfo(policy, e, counters, proxyDescriptor.idempotentOrAtMostOnce(method), expectFailoverCount); if (retryInfo.isFail()) { // fail. if (retryInfo.action.reason != null) { if (LOG.isDebugEnabled()) { LOG.debug("Exception while invoking call #" + callId + " " + proxyDescriptor.getProxyInfo().getString(method.getName()) + ". Not retrying because " + retryInfo.action.reason, e); } } throw retryInfo.getFailException(); } log(method, retryInfo.isFailover(), counters.failovers, retryInfo.delay, e); return retryInfo; }