@Override public Object get(long timeout, TimeUnit unit) throws Throwable { final CallReturn c = asyncCallReturn.waitAsyncValue(timeout, unit); final Object r = c.getReturnValue(); hasSuccessfulCall = true; return r; }
synchronized void processRetryInfo() { counters.retries++; if (retryInfo.isFailover()) { retryInvocationHandler.proxyDescriptor.failover( retryInfo.expectedFailoverCount, method, callId); counters.failovers++; } retryInfo = null; }
/** * Get the groups which are mapped to the given user. * @param user The user to get the groups for. * @return The set of groups the user belongs to. * @throws IOException */ @Idempotent public String[] getGroupsForUser(String user) throws IOException; }
/** * Remove a trace span receiver. * * @param spanReceiverId The id of the span receiver to remove. * @throws IOException On error. */ @AtMostOnce public void removeSpanReceiver(long spanReceiverId) throws IOException; }
@Override public RetryAction shouldRetry(Exception e, int retries, int failovers, boolean isIdempotentOrAtMostOnce) throws Exception { if (retries >= maxRetries) { return new RetryAction(RetryAction.RetryDecision.FAIL, 0 , getReason()); } return new RetryAction(RetryAction.RetryDecision.RETRY, timeUnit.toMillis(calculateSleepTime(retries)), getReason()); }
/** * <p> * Keep trying forever with a fixed time between attempts. * </p> */ public static final RetryPolicy retryForeverWithFixedSleep(long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumCountWithFixedSleep(Integer.MAX_VALUE, sleepTime, timeUnit); }
/** * <p> * Keep trying for a maximum time, waiting a fixed time between attempts, * and then fail by re-throwing the exception. * </p> */ public static final RetryPolicy retryUpToMaximumTimeWithFixedSleep(long maxTime, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumTimeWithFixedSleep(maxTime, sleepTime, timeUnit); }
/** * <p> * Keep trying a limited number of times, waiting a growing amount of time between attempts, * and then fail by re-throwing the exception. * The time between attempts is <code>sleepTime</code> mutliplied by the number of tries so far. * </p> */ public static final RetryPolicy retryUpToMaximumCountWithProportionalSleep(int maxRetries, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumCountWithProportionalSleep(maxRetries, sleepTime, timeUnit); }
/** * <p> * A retry policy for RemoteException * Set a default policy with some explicit handlers for specific exceptions. * </p> */ public static final RetryPolicy retryByRemoteException( RetryPolicy defaultPolicy, Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap) { return new RemoteExceptionDependentRetry(defaultPolicy, exceptionToPolicyMap); }
/** * A retry policy for exceptions other than RemoteException. */ public static final RetryPolicy retryOtherThanRemoteException( RetryPolicy defaultPolicy, Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap) { return new OtherThanRemoteExceptionDependentRetry(defaultPolicy, exceptionToPolicyMap); }
public static final RetryPolicy failoverOnNetworkException( RetryPolicy fallbackPolicy, int maxFailovers, int maxRetries, long delayMillis, long maxDelayBase) { return new FailoverOnNetworkExceptionRetry(fallbackPolicy, maxFailovers, maxRetries, delayMillis, maxDelayBase); }
CallReturn invoke() throws Throwable { return new CallReturn(invokeMethod()); }
AsyncCall newAsyncCall(Method method, Object[] args, boolean isRpc, int callId, RetryInvocationHandler<?> retryInvocationHandler) { return new AsyncCall(method, args, isRpc, callId, retryInvocationHandler, this); }
/** * Similarly, remoteExceptionToRetry is ignored as part of hashCode since it * does not affect connection failure handling. */ @Override public int hashCode() { return multipleLinearRandomRetry.hashCode(); }
/** * Refresh user to group mappings. * @throws IOException */ @Idempotent public void refreshUserToGroupsMappings() throws IOException;
/** * <p> * Keep trying a limited number of times, waiting a fixed time between attempts, * and then fail by re-throwing the exception. * </p> */ public static final RetryPolicy retryUpToMaximumCountWithFixedSleep(int maxRetries, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumCountWithFixedSleep(maxRetries, sleepTime, timeUnit); }
/** * Refresh superuser proxy group list * @throws IOException */ @Idempotent public void refreshSuperUserGroupsConfiguration() throws IOException; }
/** * Refresh the resource based on identity passed in. * @throws IOException */ @Idempotent Collection<RefreshResponse> refresh(String identifier, String[] args) throws IOException; }
/** * Refresh the callqueue. * @throws IOException */ @Idempotent void refreshCallQueue() throws IOException; }