jenkinsci/jenkins — pull request #1183 by pjdarton (2014-04-11 16:11:05+00:00)
Title: Proposed solution to JENKINS-15331

This code allows folks to configure Jenkins to be more insistent when trying to delete files by retrying a configurable number of times, with a configurable delay between attempts (and optionally calling the garbage collector, just like Ant does).
i.e. it's a solution to issue JENKINS-15331.
This will allow users on Windows to get more reliable builds even if they've got Anti-Virus software running (I've been using this technique where I work for over a year now, and it fixed it for me).

Introduces new configuration parameters, typically set using -D options when starting the Jenkins service.
-Dhudson.Util.deletionRetries=3
Sets the number of times Jenkins will try to delete a file before giving up.
Defaults to 3 attempts.

-Dhudson.Util.deletionRetryWait=100
Sets the time (in milliseconds) for which Jenkins will pause between delete attempts.
Defaults to 100ms between each attempt.
If set to a negative number, it will delay for an increasing amount between attempts.

-Dhudson.Util.performGCOnFailedDelete=false
If set to true, this tells Jenkins to run the Garbage Collector as well as waiting (just in case the process holding a file open is an un-garbage-collected Java filehandle within Jenkins itself).
It defaults to false.