BAEL-3855
This commit is contained in:
parent
dae03d6a87
commit
0692bac979
|
@ -14,8 +14,8 @@ public class SingleLock extends ConcurrentAccessExperiment {
|
|||
|
||||
protected Supplier<?> putSupplier(Map<String,String> map, int key) {
|
||||
return (()-> {
|
||||
lock.lock();
|
||||
try {
|
||||
lock.lock();
|
||||
return map.put("key" + key, "value" + key);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
@ -25,8 +25,8 @@ public class SingleLock extends ConcurrentAccessExperiment {
|
|||
|
||||
protected Supplier<?> getSupplier(Map<String,String> map, int key) {
|
||||
return (()-> {
|
||||
lock.lock();
|
||||
try {
|
||||
lock.lock();
|
||||
return map.get("key" + key);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
|
|
@ -17,8 +17,8 @@ public class StripedLock extends ConcurrentAccessExperiment {
|
|||
return (()-> {
|
||||
int bucket = key % stripedLock.size();
|
||||
Lock lock = stripedLock.get(bucket);
|
||||
lock.lock();
|
||||
try {
|
||||
lock.lock();
|
||||
return map.put("key" + key, "value" + key);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
@ -30,8 +30,8 @@ public class StripedLock extends ConcurrentAccessExperiment {
|
|||
return (()-> {
|
||||
int bucket = key % stripedLock.size();
|
||||
Lock lock = stripedLock.get(bucket);
|
||||
lock.lock();
|
||||
try {
|
||||
lock.lock();
|
||||
return map.get("key" + key);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
|
Loading…
Reference in New Issue