diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriber.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriber.java index 7a034000..81528c4e 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriber.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriber.java @@ -130,7 +130,9 @@ class ShardConsumerSubscriber implements Subscriber { Duration timeSinceLastResponse = Duration.between(lastRequestTime, now); if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) { log.error( + // CHECKSTYLE.OFF: LineLength "{}: Last request was dispatched at {}, but no response as of {} ({}). Cancelling subscription, and restarting. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength shardInfoId, lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastSuccessfulRequestDetails()); cancel(); diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java index 3a8af8c2..ca4ce12d 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java @@ -369,7 +369,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher { } else { if (triggeringFlow != null) { log.debug( + // CHECKSTYLE.OFF: LineLength "{}: [SubscriptionLifetime] - (FanOutRecordsPublisher#errorOccurred) @ {} id: {} -- {} -> triggeringFlow wasn't the active flow. Didn't dispatch error", + // CHECKSTYLE.ON: LineLength streamAndShardId, triggeringFlow.connectionStartedAt, triggeringFlow.subscribeToShardId, category.throwableTypeString); triggeringFlow.cancel(); @@ -605,7 +607,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher { synchronized (lockObject) { if (subscriber != s) { log.warn( + // CHECKSTYLE.OFF: LineLength "{}: (FanOutRecordsPublisher/Subscription#request) - Rejected an attempt to request({}), because subscribers don't match. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength streamAndShardId, n, lastSuccessfulRequestDetails); return; } @@ -632,13 +636,17 @@ public class FanOutRecordsPublisher implements RecordsPublisher { synchronized (lockObject) { if (subscriber != s) { log.warn( + // CHECKSTYLE.OFF: LineLength "{}: (FanOutRecordsPublisher/Subscription#cancel) - Rejected attempt to cancel subscription, because subscribers don't match. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength streamAndShardId, lastSuccessfulRequestDetails); return; } if (!hasValidSubscriber()) { log.warn( + // CHECKSTYLE.OFF: LineLength "{}: (FanOutRecordsPublisher/Subscription#cancel) - Cancelled called even with an invalid subscriber. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength streamAndShardId, lastSuccessfulRequestDetails); } subscriber = null; @@ -808,7 +816,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher { isErrorDispatched = true; } else { log.debug( + // CHECKSTYLE.OFF: LineLength "{}: [SubscriptionLifetime]: (RecordFlow#exceptionOccurred) @ {} id: {} -- An error has previously been dispatched, not dispatching this error {}: {}", + // CHECKSTYLE.OFF: LineLength parent.streamAndShardId, connectionStartedAt, subscribeToShardId, throwable.getClass().getName(), throwable.getMessage()); } @@ -839,7 +849,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher { .add(new RecordsRetrievedContext(Either.right(subscriptionShutdownEvent), this, Instant.now())); } catch (Exception e) { log.warn( + // CHECKSTYLE.OFF: LineLength "{}: Unable to enqueue the {} shutdown event due to capacity restrictions in delivery queue with remaining capacity {}. Ignoring. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength parent.streamAndShardId, subscriptionShutdownEvent.getEventIdentifier(), parent.recordsDeliveryQueue.remainingCapacity(), parent.lastSuccessfulRequestDetails, subscriptionShutdownEvent.getShutdownEventThrowableOptional()); } @@ -863,7 +875,9 @@ public class FanOutRecordsPublisher implements RecordsPublisher { } if (this.isDisposed) { log.warn( + // CHECKSTYLE.OFF: LineLength "{}: [SubscriptionLifetime]: (RecordFlow#complete) @ {} id: {} -- This flow has been disposed not dispatching completion. Last successful request details -- {}", + // CHECKSTYLE.ON: LineLength parent.streamAndShardId, connectionStartedAt, subscribeToShardId, parent.lastSuccessfulRequestDetails); return; } diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/KinesisDataFetcher.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/KinesisDataFetcher.java index 65da2b32..495dcfb1 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/KinesisDataFetcher.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/polling/KinesisDataFetcher.java @@ -145,7 +145,9 @@ public class KinesisDataFetcher implements DataFetcher { } } + // CHECKSTYLE.OFF: MemberName final DataFetcherResult TERMINAL_RESULT = new DataFetcherResult() { + // CHECKSTYLE.ON: MemberName @Override public GetRecordsResponse getResult() { return GetRecordsResponse.builder() diff --git a/checkstyle/checkstyle-suppressions.xml b/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 00000000..91be49c8 --- /dev/null +++ b/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/checkstyle/checkstyle.xml b/checkstyle/checkstyle.xml new file mode 100644 index 00000000..07932723 --- /dev/null +++ b/checkstyle/checkstyle.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 7ebd6e54..82d7857d 100644 --- a/pom.xml +++ b/pom.xml @@ -72,6 +72,27 @@ + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.3.0 + + checkstyle/checkstyle.xml + true + true + checkstyle/checkstyle-suppressions.xml + + + + validate + + check + + + + +