Github user HansBrende commented on the issue:
https://github.com/apache/any23/pull/122
For the time being, I've opted for the third option for (4) (making the
public methods I added to `WriterFactoryRegistry` become `private static`
methods in `Rover`) so that I don't have to deal with that naming issue in this
PR. If we want to add extra utility methods in `WriterFactoryRegistry`, that
can be the subject of a different JIRA issue.
However, I did have to fix a couple of synchronization issues in
`WriterFactoryRegistry` to accomplish this: I noticed that iterating through
the list of writer factories returned by `WriterFactoryRegistry.getWriters()`
could potentially throw a `ConcurrentModificationException` even though that
method was marked `synchronized` (because, unless I am mistaken, the underlying
list implementation *can* be modified after access to the list is given to a
caller and the method returns). To fix this problem, I changed the
implementation of the backing list of writers from `ArrayList` to
`CopyOnWriteArrayList`, which guarantees thread safety for iterators. Since
writes to `CopyOnWriteArrayList` are relatively expensive, I also changed the
logic around a bit to use *batch writing*, i.e., registering all
`WriterFactory` instances at once in a `registerAll()` method, rather than
through consecutive invocations of the `register()` method. Similar issues
existed for the methods to retrieve id
entifiers and mime types, which I fixed in the same manner.
With this last commit, I am now satisfied, personally, with my
implementation of ANY23-396.
Anything else, @lewismc @jgrzebyta ?
---