BAEL-3855

This commit is contained in:
Unknown 2020-03-18 10:18:58 +01:00
parent dae03d6a87
commit 0692bac979
2 changed files with 4 additions and 4 deletions

View File

@ -14,8 +14,8 @@ public class SingleLock extends ConcurrentAccessExperiment {
protected Supplier<?> putSupplier(Map<String,String> map, int key) {
return (()-> {
try {
lock.lock();
try {
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 (()-> {
try {
lock.lock();
try {
return map.get("key" + key);
} finally {
lock.unlock();

View File

@ -17,8 +17,8 @@ public class StripedLock extends ConcurrentAccessExperiment {
return (()-> {
int bucket = key % stripedLock.size();
Lock lock = stripedLock.get(bucket);
try {
lock.lock();
try {
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);
try {
lock.lock();
try {
return map.get("key" + key);
} finally {
lock.unlock();