Object invokeMethod() throws Throwable { if (isRpc) { Client.setCallIdAndRetryCount(callId, counters.retries, retryInvocationHandler.asyncCallHandler); } return retryInvocationHandler.invokeMethod(method, args); }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); int retryCount = RetryCount.get(); if (retryCount < this.numToDrop) { RetryCount.set(++retryCount); if (LOG.isDebugEnabled()) { LOG.debug("Drop the response. Current retryCount == " + retryCount); } throw new RetriableException("Fake Exception"); } else { if (LOG.isDebugEnabled()) { LOG.debug("retryCount == " + retryCount + ". It's time to normally process the response"); } return result; } } }
Object invokeMethod() throws Throwable { if (isRpc) { Client.setCallIdAndRetryCount(callId, counters.retries, retryInvocationHandler.asyncCallHandler); } return retryInvocationHandler.invokeMethod(method, args); }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); int retryCount = RetryCount.get(); if (retryCount < this.numToDrop) { RetryCount.set(++retryCount); if (LOG.isDebugEnabled()) { LOG.debug("Drop the response. Current retryCount == " + retryCount); } throw new RetriableException("Fake Exception"); } else { if (LOG.isDebugEnabled()) { LOG.debug("retryCount == " + retryCount + ". It's time to normally process the response"); } return result; } } }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); int retryCount = RetryCount.get(); if (retryCount < this.numToDrop) { RetryCount.set(++retryCount); if (LOG.isDebugEnabled()) { LOG.debug("Drop the response. Current retryCount == " + retryCount); } throw new RetriableException("Fake Exception"); } else { if (LOG.isDebugEnabled()) { LOG.debug("retryCount == " + retryCount + ". It's time to normally process the response"); } return result; } } }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); int retryCount = RetryCount.get(); if (retryCount < this.numToDrop) { RetryCount.set(++retryCount); if (LOG.isDebugEnabled()) { LOG.debug("Drop the response. Current retryCount == " + retryCount); } throw new RetriableException("Fake Exception"); } else { if (LOG.isDebugEnabled()) { LOG.debug("retryCount == " + retryCount + ". It's time to normally process the response"); } return result; } } }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); if (block.get()) { throw new UnknownHostException("Fake Exception"); } else { return result; } } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { RetryPolicy policy = methodNameToPolicyMap.get(method.getName()); if (policy == null) { policy = defaultPolicy; } int retries = 0; while (true) { try { return invokeMethod(method, args); } catch (Exception e) { if (!policy.shouldRetry(e, retries++)) { LOG.info("Exception while invoking " + method.getName() + " of " + implementation.getClass() + ". Not retrying." + StringUtils.stringifyException(e)); if (!method.getReturnType().equals(Void.TYPE)) { throw e; // non-void methods can't fail without an exception } return null; } LOG.debug("Exception while invoking " + method.getName() + " of " + implementation.getClass() + ". Retrying." + StringUtils.stringifyException(e)); } } }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { RetryPolicy policy = methodNameToPolicyMap.get(method.getName()); if (policy == null) { policy = defaultPolicy; } int retries = 0; while (true) { try { return invokeMethod(method, args); } catch (Exception e) { if (!policy.shouldRetry(e, retries++)) { LOG.info("Exception while invoking " + method.getName() + " of " + implementation.getClass() + ". Not retrying." + StringUtils.stringifyException(e)); if (!method.getReturnType().equals(Void.TYPE)) { throw e; // non-void methods can't fail without an exception } return null; } LOG.debug("Exception while invoking " + method.getName() + " of " + implementation.getClass() + ". Retrying." + StringUtils.stringifyException(e)); } } }
@Override protected Object invokeMethod(Method method, Object[] args) throws Throwable { Object result = super.invokeMethod(method, args); int retryCount = RetryCount.get(); if (retryCount < this.numToDrop) { RetryCount.set(++retryCount); if (LOG.isDebugEnabled()) { LOG.debug("Drop the response. Current retryCount == " + retryCount); } throw new RetriableException("Fake Exception"); } else { if (LOG.isDebugEnabled()) { LOG.debug("retryCount == " + retryCount + ". It's time to normally process the response"); } return result; } } }
Object ret = invokeMethod(method, args); hasMadeASuccessfulCall = true; return ret;
Object ret = invokeMethod(method, args); hasMadeASuccessfulCall = true; return ret;
Object ret = invokeMethod(method, args); hasMadeASuccessfulCall = true; return ret;