public interface GenericFileExclusiveReadLockStrategy<T>
IdempotentRepository
to hold the read locks
which allows to support clustering.Modifier and Type | Method and Description |
---|---|
boolean |
acquireExclusiveReadLock(GenericFileOperations<T> operations,
GenericFile<T> file,
org.apache.camel.Exchange exchange)
Acquires exclusive read lock to the file.
|
void |
prepareOnStartup(GenericFileOperations<T> operations,
GenericFileEndpoint<T> endpoint)
Allows custom logic to be run on startup preparing the strategy, such as
removing old lock files etc.
|
void |
releaseExclusiveReadLockOnAbort(GenericFileOperations<T> operations,
GenericFile<T> file,
org.apache.camel.Exchange exchange)
Releases the exclusive read lock granted by the
acquireExclusiveReadLock method due an abort operation
(acquireExclusiveReadLock returned false).
|
void |
releaseExclusiveReadLockOnCommit(GenericFileOperations<T> operations,
GenericFile<T> file,
org.apache.camel.Exchange exchange)
Releases the exclusive read lock granted by the
acquireExclusiveReadLock method due a commit operation (Exchange
processing succeeded)
|
void |
releaseExclusiveReadLockOnRollback(GenericFileOperations<T> operations,
GenericFile<T> file,
org.apache.camel.Exchange exchange)
Releases the exclusive read lock granted by the
acquireExclusiveReadLock method due a rollback operation
(Exchange processing failed)
|
void |
setCheckInterval(long checkInterval)
Sets the check interval period.
|
void |
setDeleteOrphanLockFiles(boolean deleteOrphanLockFiles)
Sets whether orphan marker files should be deleted upon startup
|
void |
setMarkerFiler(boolean markerFile)
Sets whether marker file should be used or not.
|
void |
setReadLockLoggingLevel(org.apache.camel.LoggingLevel readLockLoggingLevel)
Sets logging level used when a read lock could not be acquired.
|
void |
setTimeout(long timeout)
Sets an optional timeout period.
|
void prepareOnStartup(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint) throws Exception
operations
- generic file operationsendpoint
- the endpointException
- can be thrown in case of errorsboolean acquireExclusiveReadLock(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
operations
- generic file operationsfile
- the fileexchange
- the exchangeException
- can be thrown in case of errorsvoid releaseExclusiveReadLockOnAbort(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
operations
- generic file operationsfile
- the fileexchange
- the exchangeException
- can be thrown in case of errorsvoid releaseExclusiveReadLockOnRollback(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
operations
- generic file operationsfile
- the fileexchange
- the exchangeException
- can be thrown in case of errorsvoid releaseExclusiveReadLockOnCommit(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
operations
- generic file operationsfile
- the fileexchange
- the exchangeException
- can be thrown in case of errorsvoid setTimeout(long timeout)
timeout
- period in millisvoid setCheckInterval(long checkInterval)
checkInterval
- interval in millisvoid setReadLockLoggingLevel(org.apache.camel.LoggingLevel readLockLoggingLevel)
readLockLoggingLevel
- LoggingLevelvoid setMarkerFiler(boolean markerFile)
markerFile
- true to use marker files.void setDeleteOrphanLockFiles(boolean deleteOrphanLockFiles)
deleteOrphanLockFiles
- true to delete files,
false to skip this checkApache Camel