
2007年12月25日 16:56:21
EnumMap<K extends Enum<K>, V>类为非线程安全
|
Like most collection implementations <tt>EnumMap</tt> is not synchronized. If multiple threads access an enum map concurrently, and at least one of the threads modifies the map, it should be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the enum map. If no such object exists, the map should be "wrapped" using the method. This is best done at creation time, to prevent accidental unsynchronized access: |
一共有 0 条评论