commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Grobmeier (JIRA)" <>
Subject [jira] Commented: (COMPRESS-60) ChangeSet does not synchronise whilst using the Iterator
Date Sat, 28 Mar 2009 13:03:50 GMT


Christian Grobmeier commented on COMPRESS-60:

Reading this, I would think that we should remove asSet() to avoid those conflicts.
I cannot think about a usecase where a user should iterate over the set he just created.

Sebb, as a threading guru, I am asking myself why I used a synchronized set. When removing
is this necessary? I think not.

> ChangeSet does not synchronise whilst using the Iterator
> --------------------------------------------------------
>                 Key: COMPRESS-60
>                 URL:
>             Project: Commons Compress
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.0
> ChangeSet does not synchronize whilst using the Iterator on the Set "changes" which is
a synchronizedSet.
> The Javadoc for Collections.synchronizedSet says: "
> ...
> It is imperative that the user manually synchronize on the returned set when iterating
over it:
> ...
> Failure to follow this advice may result in non-deterministic behavior."
> This affects the add() and perfom() methods.
> Also, the asSet() method returns a reference to the Set.  This method does not seem to
be used at present, so perhaps could be removed.
> Otherwise, it should either return a copy of the set, or the Javadoc should point out
that any iteration over the set must synchronize on the set.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message