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

View File

@ -17,8 +17,8 @@ public class StripedLock extends ConcurrentAccessExperiment {
return (()-> { return (()-> {
int bucket = key % stripedLock.size(); int bucket = key % stripedLock.size();
Lock lock = stripedLock.get(bucket); Lock lock = stripedLock.get(bucket);
try {
lock.lock(); lock.lock();
try {
return map.put("key" + key, "value" + key); return map.put("key" + key, "value" + key);
} finally { } finally {
lock.unlock(); lock.unlock();
@ -30,8 +30,8 @@ public class StripedLock extends ConcurrentAccessExperiment {
return (()-> { return (()-> {
int bucket = key % stripedLock.size(); int bucket = key % stripedLock.size();
Lock lock = stripedLock.get(bucket); Lock lock = stripedLock.get(bucket);
try {
lock.lock(); lock.lock();
try {
return map.get("key" + key); return map.get("key" + key);
} finally { } finally {
lock.unlock(); lock.unlock();