diff --git a/core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/concurrent/lock/CoarseGrained.java b/core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/concurrent/lock/CoarseGrained.java deleted file mode 100644 index a9af3e1bba..0000000000 --- a/core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/concurrent/lock/CoarseGrained.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.concurrent.lock; - -import java.util.Map; -import java.util.concurrent.locks.ReentrantLock; - -import com.google.common.base.Supplier; - -public class CoarseGrained extends ConcurrentAccessMap { - ReentrantLock lock; - - public CoarseGrained(Map map) { - super(map); - lock = new ReentrantLock(); - } - - protected Supplier putSupplier(int x) { - return (()-> { - boolean done = false; - while(!done) { - done = lock.tryLock(); - } - map.put("key" + x, "value" + x); - lock.unlock(); - return null; - }); - } - - protected Supplier getSupplier(int x) { - return (()-> { - boolean done = false; - while(!done) { - done = lock.tryLock(); - } - map.get("key" + x); - lock.unlock(); - return null; - }); - } -}