allthingssecurity commented on code in PR #28136:
URL: https://github.com/apache/camel/pull/28136#discussion_r4320247744
##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/stream/AWS2S3StreamUploadProducer.java:
##########
@@ -71,9 +72,21 @@ public class AWS2S3StreamUploadProducer extends
DefaultProducer {
private static final Logger LOG =
LoggerFactory.getLogger(AWS2S3StreamUploadProducer.class);
private static final String TIMEOUT_CHECKER_EXECUTOR_NAME =
"S3_Streaming_Upload_Timeout_Checker";
+ // the number of timestamp windows whose completed uploads are counted
+ private static final int MAX_COUNTED_WINDOWS = 10000;
private AtomicInteger part = new AtomicInteger();
private UploadState uploadAggregate = null;
private final Map<Long, UploadState> timestampBasedUploads = new
ConcurrentHashMap<>();
+ // The uploads completed for each timestamp window, guarded by the lock. A
window is uploaded again when it gets
+ // more messages after its upload was completed (batchMessageNumber,
batchSize or streamingUploadTimeout); the new
+ // object gets a name of its own, as an object with the name of the first
one would replace it. Only the windows
+ // used last are counted, so a long-running producer does not keep every
window it has seen.
+ private final Map<Long, Integer> completedUploadsByWindow = new
LinkedHashMap<>(16, 0.75f, true) {
Review Comment:
Thanks. Every access to the map is under the producer's lock and nothing
iterates over it (only `merge` and `getOrDefault`), so the access order is safe
as it is; the field comment already says the lock guards it. I can spell out
"no iteration" there if a maintainer prefers.
On the pre-existing point in the review: a timeout flush that fails is not
counted, but a failed flush stores no object either (the multipart upload is
not completed), so the next upload of that window takes the name the failed one
would have had, and nothing is replaced.
_Claude Code on behalf of allthingssecurity_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]