Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: initial edits...

...

This code does not violate CON40-J. Do not synchronize on a collection view if the backing collection is still accessible, because while it does synchronize on a collectoin view (the synchronizedList), the backing collection is not accessible, and hence cannot be modified by any code.

...

This compliant solution does not use Collections.synchronizedMap() because locking on the (unsynchronized) map provides sufficient thread-safety for this application. The guideline CON40-J. Do not synchronize on a collection view if the backing collection is still accessible provides more information about synchronizing on synchronizedMap objects.

...