Package com.mapr.baseutils.utils
Class HashMapLocks
- java.lang.Object
-
- com.mapr.baseutils.utils.HashMapLocks
-
public class HashMapLocks extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description HashMapLocks()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidlock(int id)booleantryLock(int id)Attempts to obtain the lock of the object corresponding to the argument.voidunlock(int id)
-
-
-
Method Detail
-
lock
public void lock(int id)
-
tryLock
public boolean tryLock(int id)
Attempts to obtain the lock of the object corresponding to the argument. Returns 'true' if the lock could be taken or 'false' otherwise- Parameters:
id-- Returns:
- 'true' if the lock could be taken or 'false' otherwise
-
unlock
public void unlock(int id)
-
-