ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant Project.java
Date Thu, 17 Apr 2003 04:50:27 GMT
conor       2003/04/16 21:50:27

  Modified:    src/main/org/apache/tools/ant Project.java
  Log:
  Improve event dispatch performance (OK because we are using a cloned
  list of listeners)
  
  PR:	19101
  Submiitted By:	smagoun from mac.com
  
  Revision  Changes    Path
  1.137     +16 -9     ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.136
  retrieving revision 1.137
  diff -u -w -u -r1.136 -r1.137
  --- Project.java	15 Apr 2003 17:23:15 -0000	1.136
  +++ Project.java	17 Apr 2003 04:50:27 -0000	1.137
  @@ -1958,7 +1958,8 @@
       public void fireBuildStarted() {
           BuildEvent event = new BuildEvent(this);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.buildStarted(event);
           }
  @@ -1974,7 +1975,8 @@
           BuildEvent event = new BuildEvent(this);
           event.setException(exception);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.buildFinished(event);
           }
  @@ -1990,7 +1992,8 @@
       protected void fireTargetStarted(Target target) {
           BuildEvent event = new BuildEvent(target);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.targetStarted(event);
           }
  @@ -2010,7 +2013,8 @@
           BuildEvent event = new BuildEvent(target);
           event.setException(exception);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.targetFinished(event);
           }
  @@ -2027,7 +2031,8 @@
           registerThreadTask(Thread.currentThread(), task);
           BuildEvent event = new BuildEvent(task);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.taskStarted(event);
           }
  @@ -2050,7 +2055,8 @@
           BuildEvent event = new BuildEvent(task);
           event.setException(exception);
           Vector listeners = getBuildListeners();
  -        for (int i = 0; i < listeners.size(); i++) {
  +        int size = listeners.size();
  +        for (int i = 0; i < size; i++) {
               BuildListener listener = (BuildListener) listeners.elementAt(i);
               listener.taskFinished(event);
           }
  @@ -2077,7 +2083,8 @@
                       + " - infinite loop terminated");
               }
               loggingMessage = true;
  -            for (int i = 0; i < listeners.size(); i++) {
  +            int size = listeners.size();              
  +            for (int i = 0; i < size; i++) {
                   BuildListener listener = (BuildListener) listeners.elementAt(i);
                   listener.messageLogged(event);
               }
  
  
  

Mime
View raw message