commons-io
commons-io copied to clipboard
[IO-596] Add DeleteFiles utility class
This class provides configurable strategies to delete files and directories.
Adapted from the work done in https://github.com/jenkinsci/jenkins/pull/3812.
Signed-off-by: Matt Sicker [email protected]
@reviewbybees @garydgregory @jeffret-b
Note that the build is failing as there is currently an existing unit test that tests a non-existent method.
Some of this PR is likely obsolete due to the newer PathUtils delete methods. Please review these and perhaps propose enhancements?
Hi All,
For the basic operations, please use version 2.7's IOExceptionList and PathUtils methods:
delete(Path)delete(Path, DeleteOption...)deleteDirectory(Path)deleteDirectory(Path, DeleteOption...)deleteFile(Path)deleteFile(Path, DeleteOption...)
WRT:
maxRetrieswaitBetweenRetriesMillisbackoffMultiplierretryOverridingFileAttributesoverrideAllAttributes
Perhaps these attributes could encapsulated in a new CopyStrategy implements DeleteOption, CopyOption class (where deleting is a kind of copying [to the bit bucket]) which could then be used by both delete and copy methods in PathUtils?
WDYT?
Breaking up into execution strategies sounds like a good idea! Such a strategy could likely adopt a similar API to retry libraries like retry4j.
@jvz Nice idea Matt :-) let's discuss on the ML where a retry API belongs.
On Wed, Sep 2, 2020 at 10:57 AM Matt Sicker [email protected] wrote:
Breaking up into execution strategies sounds like a good idea! Such a strategy could likely adopt a similar API to retry libraries like retry4j.
I am cutting 2.8.0-RC2 now, so let's think about this for 2.9.0.
Gary
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/apache/commons-io/pull/72#issuecomment-685792005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJB6NYP6MQVO34A72S3TSTSDZMNXANCNFSM4GMIUKMA .
Another item: values like waitBetweenRetriesMillis are error prone in my experience. Over at HttpComponents, we have classes called TimeValue and Timeout that wrap a long and a TimeUnit, and I'd like to bring that in to Apache Commons, someplace...
Some of this is superseded by the new(ish) code in PathUtils.delete methods and associated utilities. If we want a retry (count/duration delay) feature, let's build it on top of the newer code.
Hi @jvz May you check PathUtils delete methods and related classes in git master and base further enhancements on that? I'll probably get a new release candidate out in a week or two. So this could be for this or the next release.