[ https://issues.apache.org/jira/browse/HDDS-2223?focusedWorklogId=322171&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-322171 ]
ASF GitHub Bot logged work on HDDS-2223: ---------------------------------------- Author: ASF GitHub Bot Created on: 02/Oct/19 19:21 Start Date: 02/Oct/19 19:21 Worklog Time Spent: 10m Work Description: nandakumar131 commented on pull request #1564: HDDS-2223. Support ReadWrite lock in LockManager. URL: https://github.com/apache/hadoop/pull/1564#discussion_r330727807 ########## File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/lock/LockManager.java ########## @@ -25,42 +25,146 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Consumer; /** * Manages the locks on a given resource. A new lock is created for each * and every unique resource. Uniqueness of resource depends on the * {@code equals} implementation of it. */ -public class LockManager<T> { +public class LockManager<R> { private static final Logger LOG = LoggerFactory.getLogger(LockManager.class); - private final Map<T, ActiveLock> activeLocks = new ConcurrentHashMap<>(); + private final Map<R, ActiveLock> activeLocks = new ConcurrentHashMap<>(); private final GenericObjectPool<ActiveLock> lockPool = new GenericObjectPool<>(new PooledLockFactory()); /** - * Creates new LockManager instance. + * Creates new LockManager instance with the given Configuration. * * @param conf Configuration object */ - public LockManager(Configuration conf) { - int maxPoolSize = conf.getInt(HddsConfigKeys.HDDS_LOCK_MAX_CONCURRENCY, + public LockManager(final Configuration conf) { + final int maxPoolSize = conf.getInt(HddsConfigKeys.HDDS_LOCK_MAX_CONCURRENCY, HddsConfigKeys.HDDS_LOCK_MAX_CONCURRENCY_DEFAULT); lockPool.setMaxTotal(maxPoolSize); } - /** * Acquires the lock on given resource. * * <p>If the lock is not available then the current thread becomes * disabled for thread scheduling purposes and lies dormant until the * lock has been acquired. + * + * @param resource on which the lock has to be acquired + * @deprecated Use {@link LockManager#writeLock} instead + */ + public void lock(final R resource) { Review comment: Yup, they are marked as `deprecated`, should be removed once we move completely to new APIs. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 322171) Time Spent: 2h 10m (was: 2h) > Support ReadWrite lock in LockManager > ------------------------------------- > > Key: HDDS-2223 > URL: https://issues.apache.org/jira/browse/HDDS-2223 > Project: Hadoop Distributed Data Store > Issue Type: Bug > Reporter: Nanda kumar > Assignee: Nanda kumar > Priority: Major > Labels: pull-request-available > Time Spent: 2h 10m > Remaining Estimate: 0h > > Currently {{LockManager}} is using exclusive lock, instead we should support > {{ReadWrite}} lock. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org