Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 283AB9C5E for ; Tue, 6 Dec 2011 16:33:43 +0000 (UTC) Received: (qmail 50853 invoked by uid 500); 6 Dec 2011 16:33:43 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 50813 invoked by uid 500); 6 Dec 2011 16:33:42 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 50806 invoked by uid 99); 6 Dec 2011 16:33:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2011 16:33:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2011 16:33:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 263CB2388A56 for ; Tue, 6 Dec 2011 16:33:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1211004 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/taskdefs/Retry.java Date: Tue, 06 Dec 2011 16:33:19 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111206163320.263CB2388A56@eris.apache.org> Author: bodewig Date: Tue Dec 6 16:33:19 2011 New Revision: 1211004 URL: http://svn.apache.org/viewvc?rev=1211004&view=rev Log: Allow retry task to sleep between retry attempts. Submitted by Arjan Veenstra. PR 52076 Modified: ant/core/trunk/CONTRIBUTORS ant/core/trunk/WHATSNEW ant/core/trunk/contributors.xml ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java Modified: ant/core/trunk/CONTRIBUTORS URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=1211004&r1=1211003&r2=1211004&view=diff ============================================================================== --- ant/core/trunk/CONTRIBUTORS (original) +++ ant/core/trunk/CONTRIBUTORS Tue Dec 6 16:33:19 2011 @@ -25,6 +25,7 @@ Anthony Wat Antoine Baudoux Antoine Levy-Lambert Anton Mazkovoi +Arjan Veenstra Arnaud Vandyck Arnout J. Kuiper Aslak Hellesôy Modified: ant/core/trunk/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1211004&r1=1211003&r2=1211004&view=diff ============================================================================== --- ant/core/trunk/WHATSNEW (original) +++ ant/core/trunk/WHATSNEW Tue Dec 6 16:33:19 2011 @@ -163,6 +163,10 @@ Other changes: * URLResources#isExists has become less noisy. Bugzilla Report 51802. + * The task has a new optional attribute retryDelay that can + be used to make the task sleep between retry attempts. + Bugzilla Report 52076. + Changes from Ant 1.8.1 TO Ant 1.8.2 =================================== Modified: ant/core/trunk/contributors.xml URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=1211004&r1=1211003&r2=1211004&view=diff ============================================================================== --- ant/core/trunk/contributors.xml (original) +++ ant/core/trunk/contributors.xml Tue Dec 6 16:33:19 2011 @@ -124,6 +124,10 @@ Mazkovoi + Arjan + Veenstra + + Arnaud Vandyck Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java?rev=1211004&r1=1211003&r2=1211004&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Retry.java Tue Dec 6 16:33:19 2011 @@ -40,6 +40,11 @@ public class Retry extends Task implemen private int retryCount = 1; /** + * The time to wait between retries in milliseconds, default to 0. + */ + private int retryDelay = 0; + + /** * set the task * @param t the task to retry. */ @@ -61,6 +66,18 @@ public class Retry extends Task implemen } /** + * set the delay between retries (in miliseconds) + * @param n the time between retries. + * @since Ant 1.8.3 + */ + public void setRetryDelay(int retryDelay) { + if (retryDelay < 0) { + throw new BuildException("delay must be a non-negative number"); + } + this.retryDelay = retryDelay; + } + + /** * perform the work * @throws BuildException if there is an error. */ @@ -81,8 +98,21 @@ public class Retry extends Task implemen exceptionMessage.append(errorMessages); throw new BuildException(exceptionMessage.toString(), getLocation()); } - log("Attempt [" + i + "]: error occurred; retrying...", e, Project.MSG_INFO); + String msg; + if (retryDelay > 0) { + msg = "Attempt [" + i + "]: error occurred; retrying after " + retryDelay + " ms..."; + } else { + msg = "Attempt [" + i + "]: error occurred; retrying..."; + } + log(msg, e, Project.MSG_INFO); errorMessages.append(StringUtils.LINE_SEP); + if (retryDelay > 0) { + try { + Thread.sleep(retryDelay); + } catch (InterruptedException ie) { + // Ignore Exception + } + } } } }