[
https://issues.apache.org/jira/browse/IO-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689490#action_12689490
]
Sebb commented on IO-201:
-------------------------
Same applies to CountingOutputStream
> CountingInputStream is partially synchronized
> ---------------------------------------------
>
> Key: IO-201
> URL: https://issues.apache.org/jira/browse/IO-201
> Project: Commons IO
> Issue Type: Bug
> Components: Filters
> Affects Versions: 1.4
> Reporter: Sebb
>
> CountingInputStream is only partially synchronized.
> The count is not synchronized when it is updated in read operations, so is
> not guaranteed to be published correctly
> The synchronization could be removed without loss of functionality.
> Not sure it makes sense to share a stream between threads anyway, as the
> underlying stream is unlikely to be thread-safe.
> If only one thread reads the stream, then the count field could be made
> volatile.
> This would allow other threads to read the count safely.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.