jackrabbit icon indicating copy to clipboard operation
jackrabbit copied to clipboard

Improvements to code involving synchronized maps

Open ghost opened this issue 8 years ago • 0 comments

These are some improvements to org.apache.jackrabbit.jcr2spi.ItemImpl and other classes which use synchronized maps.

The listeners member of ItemImpl should be made private because subclasses should not be allowed to mutate this map or iterate over it. Iterating over the map requires proper synchronization or else non-deterministic behavior can occur.

Also, the changes to throw NullPointerException if an ItemLifeCycleListener instance is null is not really a change, because it was implicitly assumed that the listeners would not be null (notifyCreated() invokes itemCreated() on each initial listener without checking for null).

I would classify these changes as efficiency and code improvements, with three exceptions that fix concurrency issues:

ghost avatar Oct 12 '17 02:10 ghost