Class CacheOperationException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- io.github.dhruv1110.jcachex.exceptions.CacheException
-
- io.github.dhruv1110.jcachex.exceptions.CacheOperationException
-
- All Implemented Interfaces:
Serializable
public class CacheOperationException extends CacheException
Exception thrown when cache operations fail at runtime.This exception indicates problems during cache operations such as:
- Read/Write operation failures
- Eviction strategy errors
- Concurrency conflicts
- Resource exhaustion
Usage Examples:
try { cache.put(key, value); } catch (CacheOperationException e) { if (e.isRetryable()) { // Implement retry logic retryOperation(); } else { // Handle permanent failure logger.error("Cache operation failed permanently: " + e.getMessage()); } }
- Since:
- 1.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.github.dhruv1110.jcachex.exceptions.CacheException
CacheException.ErrorType
-
-
Constructor Summary
Constructors Constructor Description CacheOperationException(String message)
Constructs a new cache operation exception with the specified detail message.CacheOperationException(String message, String errorCode, boolean retryable)
Constructs a new cache operation exception with specific error code and retryable flag.CacheOperationException(String message, Throwable cause)
Constructs a new cache operation exception with the specified detail message and cause.CacheOperationException(String message, Throwable cause, String errorCode, boolean retryable)
Constructs a new cache operation exception with cause, error code and retryable flag.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CacheOperationException
concurrentModification(Object key)
Creates an operation exception for concurrent modification conflicts.static CacheOperationException
evictionFailure(Throwable cause)
Creates an operation exception for eviction failures.static CacheOperationException
invalidCacheState(String state)
Creates an operation exception for cache state errors.static CacheOperationException
invalidKey(Object key)
Creates an operation exception for key validation failures.static CacheOperationException
invalidValue(Object value)
Creates an operation exception for value validation failures.static CacheOperationException
serializationFailure(Object key, Throwable cause)
Creates an operation exception for serialization failures.-
Methods inherited from class io.github.dhruv1110.jcachex.exceptions.CacheException
getErrorCode, getErrorType, isRetryable, toString
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
CacheOperationException
public CacheOperationException(String message)
Constructs a new cache operation exception with the specified detail message.- Parameters:
message
- the detail message
-
CacheOperationException
public CacheOperationException(String message, Throwable cause)
Constructs a new cache operation exception with the specified detail message and cause.- Parameters:
message
- the detail messagecause
- the cause
-
CacheOperationException
public CacheOperationException(String message, String errorCode, boolean retryable)
Constructs a new cache operation exception with specific error code and retryable flag.- Parameters:
message
- the detail messageerrorCode
- the specific operation error coderetryable
- whether this operation can be retried
-
CacheOperationException
public CacheOperationException(String message, Throwable cause, String errorCode, boolean retryable)
Constructs a new cache operation exception with cause, error code and retryable flag.- Parameters:
message
- the detail messagecause
- the causeerrorCode
- the specific operation error coderetryable
- whether this operation can be retried
-
-
Method Detail
-
invalidKey
public static CacheOperationException invalidKey(Object key)
Creates an operation exception for key validation failures.- Parameters:
key
- the invalid key- Returns:
- a new CacheOperationException
-
invalidValue
public static CacheOperationException invalidValue(Object value)
Creates an operation exception for value validation failures.- Parameters:
value
- the invalid value- Returns:
- a new CacheOperationException
-
concurrentModification
public static CacheOperationException concurrentModification(Object key)
Creates an operation exception for concurrent modification conflicts.- Parameters:
key
- the key involved in the conflict- Returns:
- a new CacheOperationException
-
invalidCacheState
public static CacheOperationException invalidCacheState(String state)
Creates an operation exception for cache state errors.- Parameters:
state
- the invalid state- Returns:
- a new CacheOperationException
-
evictionFailure
public static CacheOperationException evictionFailure(Throwable cause)
Creates an operation exception for eviction failures.- Parameters:
cause
- the underlying cause- Returns:
- a new CacheOperationException
-
serializationFailure
public static CacheOperationException serializationFailure(Object key, Throwable cause)
Creates an operation exception for serialization failures.- Parameters:
key
- the key being serializedcause
- the underlying cause- Returns:
- a new CacheOperationException
-
-