Github user alasdairhodge commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/381#discussion_r21539467
--- Diff: utils/common/src/main/java/brooklyn/util/os/Os.java ---
@@ -231,13 +231,18 @@ public static DeletionResult deleteRecursively(File
dir) {
*/
@Beta
public static DeletionResult deleteRecursively(File dir, boolean
skipSafetyChecks) {
+ if (dir==null) return new DeletionResult(null, true, null);
+
try {
- if (dir==null) return new DeletionResult(null, true, null);
-
if (!skipSafetyChecks) checkSafe(dir);
FileUtils.deleteDirectory(dir);
return new DeletionResult(dir, true, null);
+ } catch (IllegalArgumentException e) {
+ // See exception reported in
https://issues.apache.org/jira/browse/BROOKLYN-72
+ // If another thread is changing the contents of the directory
at the same time as
+ // we delete it, then can get this exception. Try three times,
and then give up.
+ return new DeletionResult(dir, false, e);
--- End diff --
"Try three times"? Code above retries for one second.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---