Package org.mariadb.jdbc.client.util
Class ClosableLock
- java.lang.Object
-
- java.util.concurrent.locks.ReentrantLock
-
- org.mariadb.jdbc.client.util.ClosableLock
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.AutoCloseable
,java.util.concurrent.locks.Lock
public final class ClosableLock extends java.util.concurrent.locks.ReentrantLock implements java.lang.AutoCloseable
Utility class to permit use AutoClosable, ensuring proper lock release.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ClosableLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
ClosableLock
closeableLock()
Default constructor, retaining lock.-
Methods inherited from class java.util.concurrent.locks.ReentrantLock
getHoldCount, getOwner, getQueuedThreads, getQueueLength, getWaitingThreads, getWaitQueueLength, hasQueuedThread, hasQueuedThreads, hasWaiters, isFair, isHeldByCurrentThread, isLocked, lock, lockInterruptibly, newCondition, toString, tryLock, tryLock, unlock
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
closeableLock
public ClosableLock closeableLock()
Default constructor, retaining lock.- Returns:
- Closable lock
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-