public interface IOperationCacheHandler extends IOperationDelegate
AbstractSynchronizableOperation
. Furthermore it is an
IOperationDelegate
and its IOperationDelegate.onOperationFailed(IOperation)
and
IOperationDelegate.onOperationFinished(IOperation)
methods are called as the first
delegates in AbstractSynchronizableOperation.notifyOperationFailed()
and AbstractSynchronizableOperation.notifyOperationFinished()
.
There are several way to set it:
OperationHandler.getCacheHandler(IOperation)
AbstractSynchronizableOperation.setCacheHandler(IOperationCacheHandler)
A typical use case is the caching of the operations results (for performance issues or offline functionality).
Modifier and Type | Method and Description |
---|---|
void |
afterOperationExecution(IOperation operation)
Is invoked after the operation itself is started with
IOperation#internalExecute() . |
void |
beforeOperationExecution(IOperation operation)
Is invoked before the operation itself is started with
IOperation#internalExecute() . |
void |
setCacheManager(ICacheManager cacheManager)
Set the
ICacheManager that should be used for the IOperation . |
boolean |
skipOperationExecution(IOperation operation) |
onOperationFailed, onOperationFinished
void beforeOperationExecution(IOperation operation)
IOperation#internalExecute()
. Can be used to read some data from the
cache and set it into the operation.void afterOperationExecution(IOperation operation)
IOperation#internalExecute()
. Can be used to read data from the
operation and write it into the cache.boolean skipOperationExecution(IOperation operation)
IOperation
should be skipped,
e.g. if the result is offline and the operation will fail anyway
(with a costly timeout).void setCacheManager(ICacheManager cacheManager)
ICacheManager
that should be used for the IOperation
.