Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 37942 invoked from network); 19 Sep 2007 12:01:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Sep 2007 12:01:11 -0000 Received: (qmail 74062 invoked by uid 500); 19 Sep 2007 12:01:03 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 73752 invoked by uid 500); 19 Sep 2007 12:01:02 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 73741 invoked by uid 500); 19 Sep 2007 12:01:02 -0000 Received: (qmail 73738 invoked by uid 99); 19 Sep 2007 12:01:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 05:01:02 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Sep 2007 12:03:06 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BB7B11A9832; Wed, 19 Sep 2007 05:00:47 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r577261 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java Date: Wed, 19 Sep 2007 12:00:47 -0000 To: ant-cvs@apache.org From: peterreilly@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070919120047.BB7B11A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: peterreilly Date: Wed Sep 19 05:00:46 2007 New Revision: 577261 URL: http://svn.apache.org/viewvc?rev=577261&view=rev Log: checkstyle Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java?rev=577261&r1=577260&r2=577261&view=diff ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Parallel.java Wed Sep 19 05:00:46 2007 @@ -49,6 +49,8 @@ public class Parallel extends Task implements TaskContainer { + private static final int NUMBER_TRIES = 100; + /** Class which holds a list of tasks to execute */ public static class TaskList implements TaskContainer { /** Collection holding the nested tasks */ @@ -354,7 +356,7 @@ killAll(running); } - if (interrupted){ + if (interrupted) { throw new BuildException("Parallel execution interrupted."); } if (timedOut) { @@ -383,30 +385,26 @@ /** * Doesn't do anything if all threads where already gone, - * else it tries to kill the threads 3 times. + * else it tries to interrupt the threads 100 times. * @param running The list of tasks that may currently be running. */ private void killAll(TaskRunnable[] running) { boolean oneAlive; int tries = 0; - do - { + do { oneAlive = false; - for (int i = 0; i < running.length; i++) - { - if (running[i] != null && ! running[i].isFinished()) - { + for (int i = 0; i < running.length; i++) { + if (running[i] != null && !running[i].isFinished()) { running[i].interrupt(); Thread.yield(); oneAlive = true; } } - if (oneAlive) - { + if (oneAlive) { tries++; Thread.yield(); } - } while (oneAlive && tries < 100); + } while (oneAlive && tries < NUMBER_TRIES); } /** @@ -484,8 +482,7 @@ return finished; } - void interrupt() - { + void interrupt() { thread.interrupt(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org