• Home
  • History
  • Annotate
  • only in /external/mockito/src/main/java/org/mockito/internal/util/concurrent/
NameDateSize

..29-Aug-20174 KiB

DetachedThreadLocal.java29-Aug-20173.8 KiB

LICENSE29-Aug-201711.1 KiB

README.md29-Aug-20171.4 KiB

WeakConcurrentMap.java29-Aug-201711.1 KiB

WeakConcurrentSet.java29-Aug-20173.7 KiB

README.md

1This is a miniature implementation of a concurrent, lock-free (as in lock-less) hash map with weak keys where keys respect reference equality. Such a hash map removes entries containing collected keys by either:
2
31. Inline removal (entries that contain to collected keys are removed as a result of interaction with the map).
42. Implicit concurrent removal (entries that contain collected keys are removed by an external thread).
53. Explicit concurrent removal (explicit interaction with the map's reference queue).
6
7As a wrapper around this `WeakConcurrentMap`, this package also contains a `DetachedThreadLocal` which describes a weak concurrent map where the current thread serves as a key of the map. Also, this package delivers a `WeakConcurrentSet` as a wrapper around a weak concurrent map.
8
9This map does not implement the `java.util.Map` interface to simplify the implementation. Writes to the map might cause blocking if many threads write to the map concurrently (this is implied by the maps backing by a `ConcurrentHashMap` and a `ReferenceQueue`), the performance of the map is however significantly better than using a synchronized wrapper around a concurrent hash map.
10
11The library is hosted on *Maven Central* and *JCenter*:
12
13```xml
14<dependency>
15  <groupId>com.blogspot.mydailyjava</groupId>
16  <artifactId>weak-lock-free</artifactId>
17  <version>0.11</version>
18</dependency>
19```
20