ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1551113 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
Date Mon, 16 Dec 2013 04:20:51 GMT
Author: antoine
Date: Mon Dec 16 04:20:51 2013
New Revision: 1551113

URL: http://svn.apache.org/r1551113
Log:
making the exec task fast again, using the patch provided by Tim Whittington, Bugzilla PR
54128

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=1551113&r1=1551112&r2=1551113&view=diff
==============================================================================
--- ant/core/trunk/CONTRIBUTORS (original)
+++ ant/core/trunk/CONTRIBUTORS Mon Dec 16 04:20:51 2013
@@ -358,6 +358,7 @@ Thomas Quas
 Tim Drury
 Tim Fennell
 Tim Stephenson
+Tim Whittington
 Timoteo Ohara
 Timothy Gerard Endres
 Tom Ball

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1551113&r1=1551112&r2=1551113&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Dec 16 04:20:51 2013
@@ -22,6 +22,9 @@ Fixed bugs:
    made macrodef fail.
    Bugzilla Report 55885.
 
+ * Ant 1.8 exec task changes have slowed exec to a crawl
+   Bugzilla Report 54128.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=1551113&r1=1551112&r2=1551113&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Mon Dec 16 04:20:51 2013
@@ -1436,6 +1436,10 @@
     <last>Fennell</last>
   </name>
   <name>
+    <first>Tim</first>
+    <last>Whittington</last>
+  </name>
+  <name>
     <first>Timoteo</first>
     <last>Ohara</last>
   </name>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java?rev=1551113&r1=1551112&r2=1551113&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java Mon Dec 16
04:20:51 2013
@@ -185,10 +185,10 @@ public class PumpStreamHandler implement
                 return;
             }
 
-            t.join(JOIN_TIMEOUT);
             if (s != null && !s.isFinished()) {
                 s.stop();
             }
+            t.join(JOIN_TIMEOUT);
             while ((s == null || !s.isFinished()) && t.isAlive()) {
                 t.interrupt();
                 t.join(JOIN_TIMEOUT);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java?rev=1551113&r1=1551112&r2=1551113&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java Mon Dec 16 04:20:51
2013
@@ -116,7 +116,6 @@ public class StreamPumper implements Run
             started = true;
         }
         finished = false;
-        finish = false;
 
         final byte[] buf = new byte[bufferSize];
 
@@ -130,13 +129,29 @@ public class StreamPumper implements Run
                 }
 
                 length = is.read(buf);
-                if (length <= 0 || finish || Thread.interrupted()) {
+                if (length <= 0 || Thread.interrupted()) {
                     break;
                 }
                 os.write(buf, 0, length);
                 if (autoflush) {
                     os.flush();
                 }
+                if (finish) {
+                	break;
+                }
+            }
+            // On completion, drain any available data (which might be the first data available
for quick executions)
+            if (finish) {
+                while((length = is.available()) > 0) {
+                	if (Thread.interrupted()) {
+                		break;
+                	}
+                    length = is.read(buf, 0, Math.min(length, buf.length));
+                    if (length <= 0) {
+                        break;
+                    }
+                    os.write(buf, 0, length);
+                }
             }
             os.flush();
         } catch (InterruptedException ie) {
@@ -150,6 +165,7 @@ public class StreamPumper implements Run
                 FileUtils.close(os);
             }
             finished = true;
+            finish = false;
             synchronized (this) {
                 notifyAll();
             }



Mime
View raw message