-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileUtils.foreceDelete consumed on Windows-System a lot of system resources #21
Comments
The why can be read in the javadoc of the method: /**
* Accommodate Windows bug encountered in both Sun and IBM JDKs.
* Others possible. If the delete does not work, call System.gc(),
* wait a little and try again.
*
* @param file a file
* @throws IOException if any
*/
private static boolean deleteFile( File file )
throws IOException Furthermore you have analysed it so in deepth why not offering a patch and make it better ? Apart from that I have my doubts that this method is causing long running build in Eclipse cause it will not being called. The question is how you are doing full builds in Eclipse? Which Eclipse version do you use? Which Maven version do you use? and of course which M2E version do you use? |
Is the bug still present these days? |
I saw that comment, but there are no references to have a look at :( As describted in the blog it is in the yuicompressor-plugin which just want to be sure a file does not exists on the filesystem. If some other plugin will use this function in the same way it will also end up in consuming 100% CPU and slows down the build. @khmarbaise I just want to understand why it is programmed in this way, before changing it to use just file.delete (like commons-io, it looks like tjey have not those mentioned problems) -- changing without any question can produce a lot of trouble in the code which uses this function and in the community. @michael-o: the code ist from the latest version 3.0.24 |
@muehlehh I was talking about:
|
The foreceDelete will consume on Windows system a lot of time, if it is called a lot of times for files which are not present on the file system.
The method did the following:
if ( !file.delete() ) {
if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) {
file = file.getCanonicalFile();
System.gc();
}
try {
Thread.sleep( 10 );
return file.delete();
} catch ( InterruptedException ignore ) {
return file.delete();
}
}
I suggest to have a look at the {{commons-io}} variant, which is much simpler and did not do any assumption on the opperation system.
A detailed blog entry can be found on my blog: https://kaffeeumeins.de/interesting-code-org-codehaus-plexus-util-fileutils-forcedeletefile
The text was updated successfully, but these errors were encountered: