[
https://issues.apache.org/jira/browse/JCI-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13752237#comment-13752237
]
Sebb commented on JCI-70:
-------------------------
The observers field is a read-only collection.
However, the field itself is not safely published, so problems could arise if
the collection is recreated whilst the daemon thread is running.
Also the collection entries are mutable; if they are changed whilst the thread
is running there could be thread-safety issues.
If the collection is only changed/updated before starting the daemon thread,
the code looks to be thread-safe.
If the intention is to allow subsequent changes, then the code needs to be
amended, either by adding locks or by using data structures intended for
concurrent access.
> FilesystemAlterationMonitor.run() does not use lock when accessing observers
> ----------------------------------------------------------------------------
>
> Key: JCI-70
> URL: https://issues.apache.org/jira/browse/JCI-70
> Project: Commons JCI
> Issue Type: Bug
> Reporter: Sebb
>
> The method FilesystemAlterationMonitor.run() accesses observers but does not
> use the observersLock. This could lead to unexpected behaviour if the
> observers map can be changed whilst the loop is running.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira