Class OpenPoolException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.pool.exception.OpenPoolException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
OpenPoolException - Pool Exception
OpenPoolException - 对象池异常
Exception class for object pool operations, supporting error types and factory methods for common error scenarios.
对象池操作异常类,支持错误类型和常见错误场景的工厂方法。
Features | 主要功能:
- Error type classification - 错误类型分类
- Pool name tracking - 池名称追踪
- Factory methods for common errors - 常见错误的工厂方法
- Extends OpenException for unified handling - 继承OpenException统一处理
Usage Examples | 使用示例:
throw new OpenPoolException("Pool operation failed");
throw OpenPoolException.exhausted("connection-pool");
throw OpenPoolException.timeout("db-pool", Duration.ofSeconds(5));
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Serializable: Yes - 可序列化: 是
- Since:
- JDK 25, opencode-base-pool V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumPool error type enumeration. -
Constructor Summary
ConstructorsConstructorDescriptionOpenPoolException(String message) Creates exception with message.OpenPoolException(String message, String poolName, OpenPoolException.PoolErrorType errorType) Creates exception with full details.OpenPoolException(String message, String poolName, OpenPoolException.PoolErrorType errorType, Throwable cause) Creates exception with full details and cause.OpenPoolException(String message, Throwable cause) Creates exception with message and cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenPoolExceptionactivateFailed(String poolName, Throwable cause) Creates object activation failed exception.static OpenPoolExceptionCreates pool closed exception.static OpenPoolExceptioncreateFailed(String poolName, Throwable cause) Creates object creation failed exception.static OpenPoolExceptiondestroyFailed(String poolName, Throwable cause) Creates object destruction failed exception.Gets the error type.static OpenPoolExceptionCreates pool exhausted exception.static OpenPoolExceptioninvalidState(String message) Creates invalid state exception.static OpenPoolExceptionpassivateFailed(String poolName, Throwable cause) Creates object passivation failed exception.poolName()Gets the pool name.static OpenPoolExceptionCreates timeout exception.static OpenPoolExceptionvalidationFailed(String poolName) Creates validation failed exception.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
-
OpenPoolException
Creates exception with message. 创建带消息的异常。- Parameters:
message- the message - 异常消息
-
OpenPoolException
-
OpenPoolException
public OpenPoolException(String message, String poolName, OpenPoolException.PoolErrorType errorType) Creates exception with full details. 创建带完整详情的异常。- Parameters:
message- the message - 异常消息poolName- the pool name - 池名称errorType- the error type - 错误类型
-
OpenPoolException
public OpenPoolException(String message, String poolName, OpenPoolException.PoolErrorType errorType, Throwable cause) Creates exception with full details and cause. 创建带完整详情和原因的异常。- Parameters:
message- the message - 异常消息poolName- the pool name - 池名称errorType- the error type - 错误类型cause- the cause - 原始异常
-
-
Method Details
-
poolName
-
errorType
Gets the error type. 获取错误类型。- Returns:
- the error type - 错误类型
-
exhausted
Creates pool exhausted exception. 创建池耗尽异常。- Parameters:
poolName- the pool name - 池名称- Returns:
- the exception - 异常
-
timeout
Creates timeout exception. 创建超时异常。- Parameters:
poolName- the pool name - 池名称timeout- the timeout duration - 超时时长- Returns:
- the exception - 异常
-
validationFailed
Creates validation failed exception. 创建验证失败异常。- Parameters:
poolName- the pool name - 池名称- Returns:
- the exception - 异常
-
closed
Creates pool closed exception. 创建池已关闭异常。- Parameters:
poolName- the pool name - 池名称- Returns:
- the exception - 异常
-
createFailed
Creates object creation failed exception. 创建对象创建失败异常。- Parameters:
poolName- the pool name - 池名称cause- the cause - 原始异常- Returns:
- the exception - 异常
-
destroyFailed
Creates object destruction failed exception. 创建对象销毁失败异常。- Parameters:
poolName- the pool name - 池名称cause- the cause - 原始异常- Returns:
- the exception - 异常
-
activateFailed
Creates object activation failed exception. 创建对象激活失败异常。- Parameters:
poolName- the pool name - 池名称cause- the cause - 原始异常- Returns:
- the exception - 异常
-
passivateFailed
Creates object passivation failed exception. 创建对象钝化失败异常。- Parameters:
poolName- the pool name - 池名称cause- the cause - 原始异常- Returns:
- the exception - 异常
-
invalidState
Creates invalid state exception. 创建非法状态异常。- Parameters:
message- the message - 消息- Returns:
- the exception - 异常
-