donaldp 02/04/04 02:13:07
Modified: src/main/org/apache/tools/ant/taskdefs/cvslib
RedirectingStreamHandler.java
Log:
Process the standard error in a separate thread hopefully to alleviate
blocking.
Reported By: Frederic Lavigne <[EMAIL PROTECTED]>
Revision Changes Path
1.5 +14 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java
Index: RedirectingStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- RedirectingStreamHandler.java 2 Apr 2002 09:17:30 -0000 1.4
+++ RedirectingStreamHandler.java 4 Apr 2002 10:13:07 -0000 1.5
@@ -64,10 +64,10 @@
* A dummy stream handler that just passes stuff to the parser.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.4 $ $Date: 2002/04/02 09:17:30 $
+ * @version $Revision: 1.5 $ $Date: 2002/04/04 10:13:07 $
*/
class RedirectingStreamHandler
- implements ExecuteStreamHandler
+ implements ExecuteStreamHandler, Runnable
{
private final ChangeLogParser m_parser;
private BufferedReader m_reader;
@@ -127,13 +127,25 @@
*/
public void start() throws IOException
{
+ //Start up a separate thread to consume error
+ //stream. Hopefully to avoid blocking of task
+ final Thread thread = new Thread( this, "ErrorConsumer" );
+ thread.start();
+
String line = m_reader.readLine();
while( null != line )
{
m_parser.stdout( line );
line = m_reader.readLine();
}
+ }
+ /**
+ * Process the standard error in a different
+ * thread to avoid blocking in some situaitons.
+ */
+ public void run()
+ {
// Read the error stream so that it does not block !
// We cannot use a BufferedReader as the ready() method is bugged!
// (see Bug 4329985, which is supposed to be fixed in JDK1.4 :
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>