gnodet-bot commented on code in PR #28355:
URL: https://github.com/apache/camel/pull/28355#discussion_r4360264852
##########
components/camel-tarfile/src/main/java/org/apache/camel/dataformat/tarfile/TarIterator.java:
##########
@@ -54,6 +56,7 @@ public class TarIterator implements Iterator<Message>,
Closeable {
private final Exchange exchange;
private long maxDecompressedSize = -1;
private volatile TarArchiveInputStream tarInputStream;
+ private final List<CachedOutputStream> cachedOutputStreamsToClose = new
ArrayList<>();
Review Comment:
💡 **Observation:** `cachedOutputStreamsToClose` is a plain `ArrayList`
sandwiched between two `volatile` fields (`tarInputStream` on line 58, `parent`
on line 60). The volatility of the neighbours suggests the author is thinking
about cross-thread visibility, yet `ArrayList` itself is not thread-safe.
If the splitter guarantees that iteration (`hasNext`/`next`/`close`) is
always single-threaded — which appears to be the case — this is fine as-is. But
the inconsistent concurrency signals are worth a brief comment documenting that
invariant, to prevent a future reader from assuming the collection is safe to
mutate from multiple threads.
--
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]