sdks/java/io/kinesis/src/main/java/org/apache/beam/sdk/io/kinesis/SimplifiedKinesisClient.java
/**
   * Wraps Amazon specific exceptions into more friendly format.
   *
   * @throws TransientKinesisException - in case of recoverable situation, i.e. the request rate is
   *     too high, Kinesis remote service failed, network issue, etc.
   * @throws ExpiredIteratorException - if iterator needs to be refreshed
   * @throws RuntimeException - in all other cases
   */
Wraps Amazon specific exceptions into more friendly format.
@throws TransientKinesisException - in case of recoverable situation, i.e. the request rate is
too high, Kinesis remote service failed, network issue, etc.
@throws ExpiredIteratorException - if iterator needs to be refreshed
@throws RuntimeException - in all other cases
Wraps Amazon specific exceptions into more friendly format . @throws TransientKinesisException - in case of recoverable situation i . e . the request rate is too high Kinesis remote service failed network issue etc . @throws ExpiredIteratorException - if iterator needs to be refreshed @throws RuntimeException - in all other cases
private <T> T wrapExceptions(Callable<T> callable) throws TransientKinesisException {
    try {
      return callable.call();
    } catch (ExpiredIteratorException e) {
      throw e;
    } catch (LimitExceededException | ProvisionedThroughputExceededException e) {
      throw new KinesisClientThrottledException(
          "Too many requests to Kinesis. Wait some time and retry.", e);
    } catch (AmazonServiceException e) {
      if (e.getErrorType() == AmazonServiceException.ErrorType.Service) {
        throw new TransientKinesisException("Kinesis backend failed. Wait some time and retry.", e);
      }
      throw new RuntimeException("Kinesis client side failure", e);
    } catch (AmazonClientException e) {
      if (e.isRetryable()) {
        throw new TransientKinesisException("Retryable client failure", e);
      }
      throw new RuntimeException("Not retryable client failure", e);
    } catch (Exception e) {
      throw new RuntimeException("Unknown kinesis failure, when trying to reach kinesis", e);
    }
  }
private < T > T wrapExceptions ( Callable < T > callable ) throws TransientKinesisException { try { return callable . call ( ) ; } catch ( ExpiredIteratorException e ) { throw e ; } catch ( LimitExceededException | ProvisionedThroughputExceededException e ) { throw new KinesisClientThrottledException ( "Too many requests to Kinesis. Wait some time and retry." , e ) ; } catch ( AmazonServiceException e ) { if ( e . getErrorType ( ) == AmazonServiceException . ErrorType . Service ) { throw new TransientKinesisException ( "Kinesis backend failed. Wait some time and retry." , e ) ; } throw new RuntimeException ( "Kinesis client side failure" , e ) ; } catch ( AmazonClientException e ) { if ( e . isRetryable ( ) ) { throw new TransientKinesisException ( "Retryable client failure" , e ) ; } throw new RuntimeException ( "Not retryable client failure" , e ) ; } catch ( Exception e ) { throw new RuntimeException ( "Unknown kinesis failure, when trying to reach kinesis" , e ) ; } }
Wraps Amazon specific exceptions into more friendly format.
Wraps Amazon specific exceptions into more friendly format .