org.apache.camel.component.file.strategy
Class FileChangedExclusiveReadLockStrategy
java.lang.Object
org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy
org.apache.camel.component.file.strategy.FileChangedExclusiveReadLockStrategy
- All Implemented Interfaces:
- GenericFileExclusiveReadLockStrategy<File>
public class FileChangedExclusiveReadLockStrategy
- extends MarkerFileExclusiveReadLockStrategy
Acquires exclusive read lock to the given file by checking whether the file is being
changed by scanning the file at different intervals (to detec changes).
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileChangedExclusiveReadLockStrategy
public FileChangedExclusiveReadLockStrategy()
prepareOnStartup
public void prepareOnStartup(GenericFileOperations<File> operations,
GenericFileEndpoint<File> endpoint)
- Description copied from interface:
GenericFileExclusiveReadLockStrategy
- Allows custom logic to be run on startup preparing the strategy, such as removing old lock files etc.
- Specified by:
prepareOnStartup in interface GenericFileExclusiveReadLockStrategy<File>- Overrides:
prepareOnStartup in class MarkerFileExclusiveReadLockStrategy
- Parameters:
operations - generic file operationsendpoint - the endpoint
acquireExclusiveReadLock
public boolean acquireExclusiveReadLock(GenericFileOperations<File> operations,
GenericFile<File> file,
Exchange exchange)
throws Exception
- Description copied from interface:
GenericFileExclusiveReadLockStrategy
- Acquires exclusive read lock to the file.
- Specified by:
acquireExclusiveReadLock in interface GenericFileExclusiveReadLockStrategy<File>- Overrides:
acquireExclusiveReadLock in class MarkerFileExclusiveReadLockStrategy
- Parameters:
operations - generic file operationsfile - the fileexchange - the exchange
- Returns:
- true if read lock was acquired. If false Camel
will skip the file and try it on the next poll
- Throws:
Exception - can be thrown in case of errors
getTimeout
public long getTimeout()
setTimeout
public void setTimeout(long timeout)
- Description copied from interface:
GenericFileExclusiveReadLockStrategy
- Sets an optional timeout period.
If the readlock could not be granted within the time period then the wait is stopped and the
acquireExclusiveReadLock method returns false.
- Specified by:
setTimeout in interface GenericFileExclusiveReadLockStrategy<File>- Overrides:
setTimeout in class MarkerFileExclusiveReadLockStrategy
- Parameters:
timeout - period in millis
Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.