ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bodewig <...@git.apache.org>
Subject [GitHub] ant pull request #58: Use StringBuilder instead of StringBuffer as it offers...
Date Tue, 06 Feb 2018 08:34:59 GMT
Github user bodewig commented on a diff in the pull request:

    https://github.com/apache/ant/pull/58#discussion_r166217627
  
    --- Diff: src/main/org/apache/tools/ant/taskdefs/Parallel.java ---
    @@ -377,7 +377,7 @@ public synchronized void run() {
             }
     
             // now did any of the threads throw an exception
    -        exceptionMessage = new StringBuffer();
    +        exceptionMessage = new StringBuilder();
    --- End diff --
    
    Looking through the class I don't think `exceptionMessage` needs to be an instance field
at all, it could be a local variable in `spinThreads` and get passed as an argument to `processExceptions`
without doing any harm. To me it seems it is only ever used by a single thread.
    
    Most probably a further refactoring could get rid of the `first*` instance fields as well
and have `processExceptions` return all their values nicely encapsulated in a single object
- including the accumulated messages.


---

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


Mime
View raw message