From 3b3998a59ec13854bab18bbaff5d23d5bd102087 Mon Sep 17 00:00:00 2001 From: Sahil Palvia Date: Fri, 8 Feb 2019 15:49:53 -0800 Subject: [PATCH] Fixing exception log messaging with Prefetching (#497) * Changed Prefetch to catch `SdkException` instead of `SdkClientException` * With SDK 2.x service exceptions are of the type `SdkServiceException` * Adding `*.iml` to .gitignore --- .gitignore | 2 ++ .../retrieval/polling/PrefetchRecordsPublisher.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 863e68d5..973f5095 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ target/ AwsCredentials.properties .idea +*.iml + diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/PrefetchRecordsPublisher.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/PrefetchRecordsPublisher.java index 8e9a56f2..a441f721 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/PrefetchRecordsPublisher.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/PrefetchRecordsPublisher.java @@ -25,16 +25,17 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.stream.Collectors; -import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.Validate; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; +import com.google.common.annotations.VisibleForTesting; + import lombok.Data; import lombok.NonNull; import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; -import software.amazon.awssdk.core.exception.SdkClientException; +import software.amazon.awssdk.core.exception.SdkException; import software.amazon.awssdk.services.cloudwatch.model.StandardUnit; import software.amazon.awssdk.services.kinesis.model.ExpiredIteratorException; import software.amazon.awssdk.services.kinesis.model.GetRecordsResponse; @@ -325,7 +326,7 @@ public class PrefetchRecordsPublisher implements RecordsPublisher { scope.addData(EXPIRED_ITERATOR_METRIC, 1, StandardUnit.COUNT, MetricsLevel.SUMMARY); dataFetcher.restartIterator(); - } catch (SdkClientException e) { + } catch (SdkException e) { log.error("Exception thrown while fetching records from Kinesis", e); } catch (Throwable e) { log.error("Unexpected exception was thrown. This could probably be an issue or a bug." +