You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/09/16 17:36:18 UTC
[2/2] git commit: CAMEL-6750: Fixed readLock=fileLock&delete=true for
file consumer not being able to delete file on Windows.
CAMEL-6750: Fixed readLock=fileLock&delete=true for file consumer not being able to delete file on Windows.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6a5fbc12
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6a5fbc12
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6a5fbc12
Branch: refs/heads/camel-2.12.x
Commit: 6a5fbc126f4f2c2387407b0a2ed2ab7881dfc75b
Parents: a971b79
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Sep 16 17:00:35 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Sep 16 17:35:47 2013 +0200
----------------------------------------------------------------------
.../file/strategy/GenericFileDeleteProcessStrategy.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6a5fbc12/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
index b2ccb8e..524363f 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
@@ -50,6 +50,14 @@ public class GenericFileDeleteProcessStrategy<T> extends GenericFileProcessStrat
@Override
public void commit(GenericFileOperations<T> operations, GenericFileEndpoint<T> endpoint, Exchange exchange, GenericFile<T> file) throws Exception {
+
+ // special for file lock strategy as we must release that lock first before we can delete the file
+ boolean releaseEager = exclusiveReadLockStrategy instanceof FileLockExclusiveReadLockStrategy;
+
+ if (releaseEager) {
+ exclusiveReadLockStrategy.releaseExclusiveReadLock(operations, file, exchange);
+ }
+
try {
deleteLocalWorkFile(exchange);
operations.releaseRetreivedFileResources(exchange);
@@ -82,7 +90,7 @@ public class GenericFileDeleteProcessStrategy<T> extends GenericFileProcessStrat
}
} finally {
// must release lock last
- if (exclusiveReadLockStrategy != null) {
+ if (!releaseEager && exclusiveReadLockStrategy != null) {
exclusiveReadLockStrategy.releaseExclusiveReadLock(operations, file, exchange);
}
}