You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Synchronized collections are broken in their design and, even worst, they currently don't fullfil their contract, i.e., most of the methods aren't synchronized!
Here is a comment in SynchronizedMap that should definitely make you nervous:
Similar comments can be found in the other Synchronized collection traits.
Furthermore, these traits are broken in design as ticket #6087 demonstrates.
For the above reasons, I'd highly recommend to 1) add the missing synchronized methods, and 2) deprecate all Synchronized collection traits before shipping 2.11.
However, I realize that providing synchronized collections may still be desiderable (not everyone may be happy to migrate toward a concurrent collection - though, I'd like to know what's the argument for that). For this reason, I think we could provide Synchronized wrappers like Java does. This won't help people that were mixing a Synchronized trait with other collection traits, but I really don't see how we could allow that, and still prevent users from shooting themselves in the foot. If you have a great idea, please do share it.
@dotta said: @jason I noticed #4290, but I believe the ticket I've opened has a broader scope - I'm not suggesting to "just" fix the current implementation of the Synchronized collections, but actually deprecate and eventually remove them.
Synchronized collections are broken in their design and, even worst, they currently don't fullfil their contract, i.e., most of the methods aren't synchronized!
Here is a comment in SynchronizedMap that should definitely make you nervous:
todo: also add all other methods.
Similar comments can be found in the other Synchronized collection traits.
Furthermore, these traits are broken in design as ticket #6087 demonstrates.
For the above reasons, I'd highly recommend to 1) add the missing synchronized methods, and 2) deprecate all Synchronized collection traits before shipping 2.11.
However, I realize that providing synchronized collections may still be desiderable (not everyone may be happy to migrate toward a concurrent collection - though, I'd like to know what's the argument for that). For this reason, I think we could provide Synchronized wrappers like Java does. This won't help people that were mixing a Synchronized trait with other collection traits, but I really don't see how we could allow that, and still prevent users from shooting themselves in the foot. If you have a great idea, please do share it.
This ticket is based on the following discussion https://groups.google.com/forum/#!topic/scala-internals/1gCbqTRCxAQ
The text was updated successfully, but these errors were encountered: