From 1470deb1878580e3e46a8ebcbb1538c4d94df0da Mon Sep 17 00:00:00 2001 From: mguarnaccia Date: Wed, 11 Mar 2020 11:20:37 +0100 Subject: [PATCH] Delete CoarseGrained.java --- .../concurrent/lock/CoarseGrained.java | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/concurrent/lock/CoarseGrained.java 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; - }); - } -}