ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs ExecuteJava.java
Date Fri, 05 Apr 2002 15:11:42 GMT
bodewig     02/04/05 07:11:42

  Modified:    src/main/org/apache/tools/ant Project.java
               src/main/org/apache/tools/ant/taskdefs ExecuteJava.java
  Log:
  make sure output of the spawned thread is attributed to the current
  <java> task when using the timeout feature.
  
  If you don't like the name of the method, change it 8-)
  
  Revision  Changes    Path
  1.102     +15 -1     jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Project.java	2 Apr 2002 14:59:43 -0000	1.101
  +++ Project.java	5 Apr 2002 15:11:42 -0000	1.102
  @@ -82,7 +82,7 @@
    *
    * @author duncan@x180.com
    *
  - * @version $Revision: 1.101 $
  + * @version $Revision: 1.102 $
    */
   
   public class Project {
  @@ -1873,5 +1873,19 @@
       protected void fireMessageLogged(Task task, String message, int priority) {
           BuildEvent event = new BuildEvent(task);
           fireMessageLoggedEvent(event, message, priority);
  +    }
  +
  +    /**
  +     * Treat messages generated in the given thread as messages that
  +     * come from the same task that is performed on the current
  +     * thread.
  +     *
  +     * @since 1.102, Ant 1.5
  +     */
  +    public void registerThreadLikeCurrent(Thread thread) {
  +        Task task = (Task) threadTasks.get(Thread.currentThread());
  +        if (task != null) {
  +            threadTasks.put(thread, task);
  +        }
       }
   }
  
  
  
  1.21      +1 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
  
  Index: ExecuteJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ExecuteJava.java	5 Apr 2002 13:55:50 -0000	1.20
  +++ ExecuteJava.java	5 Apr 2002 15:11:42 -0000	1.21
  @@ -139,6 +139,7 @@
                   run();
               } else {
                   thread = new Thread(this, "ExecuteJava");
  +                project.registerThreadLikeCurrent(thread);
                   // if we run into a timout, the run-away thread shall not
                   // make the VM run forever - if no timeout occurs, Ant's
                   // main thread will still be there to let the new thread
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message