Class OpenLockTimeoutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.lock.exception.OpenLockException
cloud.opencode.base.lock.exception.OpenLockTimeoutException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
Lock Timeout Exception for Acquisition Timeout
获取超时的锁超时异常
Thrown when lock acquisition times out before the lock could be obtained, providing information about the wait duration.
当锁获取在获得锁之前超时时抛出,提供有关等待时长的信息。
Features | 主要功能:
- Wait time tracking - 等待时间跟踪
- Lock name identification - 锁名称标识
- Timeout-specific handling - 特定超时处理
Usage Examples | 使用示例:
try {
lock.lock(Duration.ofSeconds(5));
} catch (OpenLockTimeoutException e) {
Duration waited = e.waitTime();
// Handle timeout | 处理超时
}
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-lock V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class OpenLockException
OpenLockException.LockErrorType -
Constructor Summary
ConstructorsConstructorDescriptionOpenLockTimeoutException(String message) Constructs a new timeout exception with message 使用消息构造新的超时异常OpenLockTimeoutException(String message, String lockName, Duration waitTime) Constructs a new timeout exception with lock name and wait time 使用锁名称和等待时间构造新的超时异常OpenLockTimeoutException(String message, Duration waitTime) Constructs a new timeout exception with wait time 使用等待时间构造新的超时异常 -
Method Summary
Methods inherited from class OpenLockException
errorType, lockNameMethods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
OpenLockTimeoutException
Constructs a new timeout exception with message 使用消息构造新的超时异常- Parameters:
message- the error message | 错误消息
-
OpenLockTimeoutException
-
OpenLockTimeoutException
-
-
Method Details
-
waitTime
Gets the time spent waiting before the timeout occurred 获取超时发生前的等待时间- Returns:
- the time spent waiting, or null if not tracked | 等待时间,如果未跟踪则为null
-