public class GenericFileRenameExclusiveReadLockStrategy<T> extends Object implements GenericFileExclusiveReadLockStrategy<T>
| Constructor and Description |
|---|
GenericFileRenameExclusiveReadLockStrategy() |
| 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.
|
long |
getTimeout() |
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.
|
public GenericFileRenameExclusiveReadLockStrategy()
public void prepareOnStartup(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint) throws Exception
GenericFileExclusiveReadLockStrategyprepareOnStartup in interface GenericFileExclusiveReadLockStrategy<T>operations - generic file operationsendpoint - the endpointException - can be thrown in case of errorspublic boolean acquireExclusiveReadLock(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
GenericFileExclusiveReadLockStrategyacquireExclusiveReadLock in interface GenericFileExclusiveReadLockStrategy<T>operations - generic file operationsfile - the fileexchange - the exchangeException - can be thrown in case of errorspublic void releaseExclusiveReadLockOnAbort(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
GenericFileExclusiveReadLockStrategyreleaseExclusiveReadLockOnAbort in interface GenericFileExclusiveReadLockStrategy<T>operations - generic file operationsfile - the fileexchange - the exchangeException - can be thrown in case of errorspublic void releaseExclusiveReadLockOnRollback(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
GenericFileExclusiveReadLockStrategyreleaseExclusiveReadLockOnRollback in interface GenericFileExclusiveReadLockStrategy<T>operations - generic file operationsfile - the fileexchange - the exchangeException - can be thrown in case of errorspublic void releaseExclusiveReadLockOnCommit(GenericFileOperations<T> operations, GenericFile<T> file, org.apache.camel.Exchange exchange) throws Exception
GenericFileExclusiveReadLockStrategyreleaseExclusiveReadLockOnCommit in interface GenericFileExclusiveReadLockStrategy<T>operations - generic file operationsfile - the fileexchange - the exchangeException - can be thrown in case of errorspublic long getTimeout()
public void setTimeout(long timeout)
GenericFileExclusiveReadLockStrategysetTimeout in interface GenericFileExclusiveReadLockStrategy<T>timeout - period in millispublic void setCheckInterval(long checkInterval)
GenericFileExclusiveReadLockStrategysetCheckInterval in interface GenericFileExclusiveReadLockStrategy<T>checkInterval - interval in millispublic void setReadLockLoggingLevel(org.apache.camel.LoggingLevel readLockLoggingLevel)
GenericFileExclusiveReadLockStrategysetReadLockLoggingLevel in interface GenericFileExclusiveReadLockStrategy<T>readLockLoggingLevel - LoggingLevelpublic void setMarkerFiler(boolean markerFile)
GenericFileExclusiveReadLockStrategysetMarkerFiler in interface GenericFileExclusiveReadLockStrategy<T>markerFile - true to use marker files.public void setDeleteOrphanLockFiles(boolean deleteOrphanLockFiles)
GenericFileExclusiveReadLockStrategysetDeleteOrphanLockFiles in interface GenericFileExclusiveReadLockStrategy<T>deleteOrphanLockFiles - true to delete files,
false to skip this checkApache Camel