类 SmartLock
java.lang.Object
cn.taketoday.util.concurrent.SmartLock
- 所有已实现的接口:
Serializable,AutoCloseable
- 直接已知子类:
SmartLock.WithCondition
Reentrant lock that can be used in a try-with-resources statement.
Typical usage:
try (SmartLock lock = this.lock.lock())
{
// Something
}
- 从以下版本开始:
- 4.0 2022/10/30 12:48
- 作者:
- Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明static classA reentrant lock with a condition that can be used in a try-with-resources statement. -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclose()static SmartLock.WithConditionstatic SmartLock.WithConditionforCondition(boolean fair) static SmartLock.WithConditionforCondition(ReentrantLock lock) boolean(专用程序包) booleanisLocked()lock()Acquires the lock.static SmartLockof()static SmartLockof(boolean fair) static SmartLockof(ReentrantLock lock)
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
lock
-
-
构造器详细资料
-
SmartLock
-
-
方法详细资料
-
lock
Acquires the lock.
- 返回:
- this AutoLock for unlocking
-
isHeldByCurrentThread
public boolean isHeldByCurrentThread()- 返回:
- whether this lock is held by the current thread
- 另请参阅:
-
newCondition
- 返回:
- a
Conditionassociated with this lock
-
isLocked
boolean isLocked() -
close
public void close()- 指定者:
close在接口中AutoCloseable
-
of
-
of
-
of
-
forCondition
-
forCondition
-
forCondition
-