Check the retryable exception lists to determine whether
the given Exception is retryable.
9366
private boolean isRetryable(Exception e)
	  {
	    final String mName = "isRetryable";

	    String exClassName = e.getClass().getName();
	    
	    boolean retVal = containsException(_retryIncludeExceptions, e) && !containsException(_retryExcludeExceptions, e);
	    
	    if(logger.isLoggable(Level.FINE)) 
	      logger.logp(Level.FINE, className, mName, mName + ": " + retVal + ": " + exClassName);

	    return retVal;
	  }
438078
def should_retry_on(self, exception_class, logger=None):
        
        for n in (self.retry_on or []):
            try:
                if issubclass(exception_class, import_attribute(n)):
                    return True
            except TaskImportError:
                if logger:
                    logger.error('should_retry_on could not import class',
                                 exception_name=n)
        return False
194405
public static boolean isRetryable(KeeperException e) {
    Objects.requireNonNull(e);

    switch (e.code()) {
      case CONNECTIONLOSS:
      case SESSIONEXPIRED:
      case SESSIONMOVED:
      case OPERATIONTIMEOUT:
        return true;

      case RUNTIMEINCONSISTENCY:
      case DATAINCONSISTENCY:
      case MARSHALLINGERROR:
      case BADARGUMENTS:
      case NONODE:
      case NOAUTH:
      case BADVERSION:
      case NOCHILDRENFOREPHEMERALS:
      case NODEEXISTS:
      case NOTEMPTY:
      case INVALIDCALLBACK:
      case INVALIDACL:
      case AUTHFAILED:
      case UNIMPLEMENTED:

      // These two should not be encountered - they are used internally by ZK to specify ranges
      case SYSTEMERROR:
      case APIERROR:

      case OK: // This is actually an invalid ZK exception code

      default:
        return false;
    }
  }
94891
def mark_error_retryable(error):
    
    if isinstance(error, Exception):
        alsoProvides(error, IRetryableError)
    elif inspect.isclass(error) and issubclass(error, Exception):
        classImplements(error, IRetryableError)
    else:
        raise ValueError(
            'only exception objects or types may be marked retryable')
183806
public boolean checkResponseForException() {
    if (!finished && rsp != null) {
      Exception e;
      if ((e = rsp.getException()) != null) {
        setError(e.getMessage());
        setFinished();
        return true;
      }
    }
    return false;
  }
895202
synchronized void resetListFailed()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "resetListFailed");

    iRequestFailed = true;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "resetListFailed");
  }
662012
boolean failure(Throwable failure) {
        State<T> oldState;
        synchronized (mutex) {
            if (state.isCompleted()) {
                return false;
            }
            oldState = state;
            state = state.getFailureState(failure);
        }
        oldState.callFailureCallbacks(failure);
        return true;
    }
959245
public static <Return> Return retryUntilNoException(Callable<Return> callable, int maxTry, Class<? extends Throwable> exceptionClass) throws Exception {
        String errMsg = "连续重试失败" + maxTry + "次。";
        Exception t = null;
        while (maxTry > 0) {
            try {
                return callable.call();
            } catch (Exception throwable) {
                if (exceptionClass.isAssignableFrom(throwable.getClass())) {
                    //只对指定的异常重试，其他异常直接抛出去
                    maxTry--;
                    t = throwable;
                } else {
                    throw throwable;
                }
            }
        }
        LOG.error(new RuntimeException(errMsg, t));
        //这里是对重试N次后依然抛出指定异常的情况，原样抛出
        throw t;
    }
1131366
def _check_exception(self):
        """"""
        if self._saved_exception is not None:
            x = self._saved_exception
            self._saved_exception = None
            raise x
565913
protected static boolean isRecoverableException(AmazonServiceException ex) {
		if (ex.getErrorType() == null) {
			return false;
		}

		switch (ex.getErrorType()) {
			case Client:
				return ex instanceof ProvisionedThroughputExceededException;
			case Service:
			case Unknown:
				return true;
			default:
				return false;
		}
	}
216005
public boolean containsCheckedExceptions() throws ClassNotFoundException {
        for (ThrownExceptionIterator i = iterator(); i.hasNext();) {
            ObjectType type = i.next();
            if (!Hierarchy.isUncheckedException(type)) {
                return true;
            }
        }
        return false;
    }
1153998
public static boolean hasException(List<TraceEvent> events)
   {
      for (TraceEvent te : events)
      {
         if (te.getType() == TraceEvent.EXCEPTION)
            return true;
      }

      return false;
   }
696885
private boolean checkPolicy(int executionCount) {
		if (mechanism.equalsIgnoreCase("fixedretry")) {
			if (this.retryCount == 0) {
				return false;
			} else if (executionCount < this.retryCount) {
				try {
					Thread.sleep((long) this.retryInterval);
					LOG.debug("The retryInterval " + this.retryInterval);
					return true;
				} catch (Exception e) {
					LOG.error(e.getMessage());
				}
			}
			return false;
		}

		// functionality for incremental retry policy
		if (mechanism.equalsIgnoreCase("incrementalretry")) {
			if (executionCount < this.retryCount) {
				try {
					Thread.sleep((long) this.initialInterval + (this.increment * executionCount));
					return true;
				} catch (Exception e) {
					LOG.error(e.getMessage());
				}
			}
			return false;
		}
		// functionality for exponential retry
		if (mechanism.equalsIgnoreCase("exponentialretry")) {
			if (executionCount < this.retryCount) {
				try {
					int delta = (int) ((Math.pow(2.0, executionCount) - 1.0)
							* (this.deltaBackoff * NUM_0_8) + (Math.random()
							* (this.deltaBackoff * NUM_1_2)
							- (this.deltaBackoff * NUM_0_8) + 1));
					int interval = (int) Math.min((this.minBackoff + delta), this.maxBackoff);
					Thread.sleep(interval);
				} catch (Exception e) {
					LOG.error(e.getMessage());
				}
				return true;
			}
			return false;
		}
		return true;
	}
364029
public static void safelyIgnoreException(Throwable t)
    {
        if (t instanceof ThreadDeath)
        {
            throw (ThreadDeath) t;
        }

        if (t instanceof OutOfMemoryError)
        {
            throw (OutOfMemoryError) t;
        }

    }
553589
public V action(Callable<V> callable) throws Exception {
        Exception re;
        RetryState retryState = retryStrategy.getRetryState();
        do {
            try {
                return callable.call();
            } catch (Exception e) {
                re = e;
                if (Thread.interrupted() || isInterruptTransitively(e)) {
                    re = new InterruptedException(e.getMessage());
                    break;
                }
                if (!transientExceptionDetector.isTransient(e)) {
                    break;
                }
            }
            enqueueRetryEvent(new RetryEvent(this, retryState, re));
            retryState.delayRetry();
        } while (retryState.hasRetries());
        throw re;
    }
500740
public static Exception rethrow(Throwable throwable) throws Error {
        try {
            throw throwable;
        } catch (Error error) {
            throw error;
        } catch (Exception exception) {
            return exception;
        } catch (Throwable throwable2) {
            return msg.undeclaredThrowable(throwable2);
        }
    }
431250
private static CounterException rethrowAsCounterException(Throwable throwable) {
      //make it public if needed.
      if (throwable instanceof CounterException) {
         return (CounterException) throwable;
      } else if (throwable instanceof ExecutionException || throwable instanceof CompletionException) {
         return rethrowAsCounterException(throwable.getCause());
      } else {
         return new CounterException(throwable);
      }
   }