Class OpenTimeoutException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.core.exception.OpenTimeoutException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
Timeout Exception - Operation timeout exception
超时异常 - 操作超时异常
Thrown when an operation exceeds the specified time limit.
当操作超过预定时间限制时抛出此异常。
Features | 主要功能:
- Duration support (getTimeout) - Duration 支持
- Static factory (of) - 静态工厂方法
- Auto duration formatting (ms/s/m) - 自动时长格式化
- Cause chain support - 原因链支持
Usage Examples | 使用示例:
if (elapsedTime > timeout) {
throw new OpenTimeoutException("Operation timed out after " + timeout + "ms");
}
// Static factory methods - 静态工厂方法
throw OpenTimeoutException.of("Database query", Duration.ofSeconds(30));
throw OpenTimeoutException.of("HTTP request", Duration.ofMinutes(1), cause);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Serializable: Yes - 可序列化: 是
- Since:
- JDK 25, opencode-base-core V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenTimeoutException(String message) Creates 创建超时异常OpenTimeoutException(String message, Throwable cause) Creates 创建超时异常(带原因)OpenTimeoutException(String message, Duration timeout) Creates 创建超时异常(带超时时长)OpenTimeoutException(String message, Duration timeout, Throwable cause) Creates 创建超时异常(完整参数) -
Method Summary
Modifier and TypeMethodDescriptionGets 获取超时时长static OpenTimeoutExceptionCreates 创建超时异常static OpenTimeoutExceptionCreates 创建超时异常(带原因)Methods 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
-
OpenTimeoutException
-
OpenTimeoutException
-
OpenTimeoutException
-
OpenTimeoutException
-
-
Method Details
-
getTimeout
-
of
Creates 创建超时异常- Parameters:
operation- the operation name | 操作名称timeout- the value | 超时时长- Returns:
- the result | 异常实例
-
of
Creates 创建超时异常(带原因)- Parameters:
operation- the operation name | 操作名称timeout- the value | 超时时长cause- the value | 原始异常- Returns:
- the result | 异常实例
-