git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1551113 13f79535-47bb-0310-9956-ffa450edef68master
@@ -358,6 +358,7 @@ Thomas Quas | |||||
Tim Drury | Tim Drury | ||||
Tim Fennell | Tim Fennell | ||||
Tim Stephenson | Tim Stephenson | ||||
Tim Whittington | |||||
Timoteo Ohara | Timoteo Ohara | ||||
Timothy Gerard Endres | Timothy Gerard Endres | ||||
Tom Ball | Tom Ball | ||||
@@ -22,6 +22,9 @@ Fixed bugs: | |||||
made macrodef fail. | made macrodef fail. | ||||
Bugzilla Report 55885. | Bugzilla Report 55885. | ||||
* Ant 1.8 exec task changes have slowed exec to a crawl | |||||
Bugzilla Report 54128. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -1435,6 +1435,10 @@ | |||||
<first>Tim</first> | <first>Tim</first> | ||||
<last>Fennell</last> | <last>Fennell</last> | ||||
</name> | </name> | ||||
<name> | |||||
<first>Tim</first> | |||||
<last>Whittington</last> | |||||
</name> | |||||
<name> | <name> | ||||
<first>Timoteo</first> | <first>Timoteo</first> | ||||
<last>Ohara</last> | <last>Ohara</last> | ||||
@@ -185,10 +185,10 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
return; | return; | ||||
} | } | ||||
t.join(JOIN_TIMEOUT); | |||||
if (s != null && !s.isFinished()) { | if (s != null && !s.isFinished()) { | ||||
s.stop(); | s.stop(); | ||||
} | } | ||||
t.join(JOIN_TIMEOUT); | |||||
while ((s == null || !s.isFinished()) && t.isAlive()) { | while ((s == null || !s.isFinished()) && t.isAlive()) { | ||||
t.interrupt(); | t.interrupt(); | ||||
t.join(JOIN_TIMEOUT); | t.join(JOIN_TIMEOUT); | ||||
@@ -116,7 +116,6 @@ public class StreamPumper implements Runnable { | |||||
started = true; | started = true; | ||||
} | } | ||||
finished = false; | finished = false; | ||||
finish = false; | |||||
final byte[] buf = new byte[bufferSize]; | final byte[] buf = new byte[bufferSize]; | ||||
@@ -130,13 +129,29 @@ public class StreamPumper implements Runnable { | |||||
} | } | ||||
length = is.read(buf); | length = is.read(buf); | ||||
if (length <= 0 || finish || Thread.interrupted()) { | |||||
if (length <= 0 || Thread.interrupted()) { | |||||
break; | break; | ||||
} | } | ||||
os.write(buf, 0, length); | os.write(buf, 0, length); | ||||
if (autoflush) { | if (autoflush) { | ||||
os.flush(); | 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(); | os.flush(); | ||||
} catch (InterruptedException ie) { | } catch (InterruptedException ie) { | ||||
@@ -150,6 +165,7 @@ public class StreamPumper implements Runnable { | |||||
FileUtils.close(os); | FileUtils.close(os); | ||||
} | } | ||||
finished = true; | finished = true; | ||||
finish = false; | |||||
synchronized (this) { | synchronized (this) { | ||||
notifyAll(); | notifyAll(); | ||||
} | } | ||||