We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02286a3 commit 6dc4edbCopy full SHA for 6dc4edb
src/main/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMap.java
@@ -23,6 +23,7 @@ protected PrimitiveConcurrentMap(int numBuckets) {
23
locks[i] = new ReentrantReadWriteLock();
24
}
25
26
+ /** Lock must be held! */
27
protected abstract Function<K,V> mapAt (int index);
28
29
@Override
@@ -59,12 +60,12 @@ public boolean isEmpty () {
59
60
61
public void clear () {
62
for (int i = 0; i < numBuckets; i++) {
- Lock readLock = locks[i].readLock();
63
- readLock.lock();
+ Lock lock = locks[i].writeLock();
64
+ lock.lock();
65
try {
66
mapAt(i).clear();
67
} finally {
- readLock.unlock();
68
+ lock.unlock();
69
70
71
0 commit comments