commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (JCI-70) does not use lock when accessing observers
Date Wed, 28 Aug 2013 09:30:52 GMT


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.
> does not use lock when accessing observers
> ----------------------------------------------------------------------------
>                 Key: JCI-70
>                 URL:
>             Project: Commons JCI
>          Issue Type: Bug
>            Reporter: Sebb
> The method 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:

View raw message