Author: ningjiang
Date: Mon Dec 22 19:36:13 2008
New Revision: 728862
URL: http://svn.apache.org/viewvc?rev=728862&view=rev
Log:
CAMEL-1195 try to get FileExclusiveReadRenameStrategyTest passed on Linux boxes
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java?rev=728862&r1=728861&r2=728862&view=diff
==============================================================================
---
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
(original)
+++
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
Mon Dec 22 19:36:13 2008
@@ -30,7 +30,7 @@
/**
* Acquires exclusive read lock to the given file. Will wait until the lock is
granted.
- * After granting the read lock it is realeased, we just want to make sure
that when we start
+ * After granting the read lock it is released, we just want to make sure that
when we start
* consuming the file its not currently in progress of being written by third
party.
*/
public class FileLockExclusiveReadLockStrategy implements
ExclusiveReadLockStrategy {
@@ -62,7 +62,13 @@
}
// get the lock using either try lock or not depending on if
we are using timeout or not
- FileLock lock = timeout > 0 ? channel.tryLock() :
channel.lock();
+ FileLock lock = null;
+ try {
+ lock = timeout > 0 ? channel.tryLock() : channel.lock();
+ } catch (IllegalStateException ex) {
+ // Also catch the OverlappingFileLockException here
+ // Do nothing here
+ }
if (lock != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Acquired exclusive read lock: " + lock + "
to file: " + file);