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/taskdefs Parallel.java
Date Mon, 14 Apr 2003 11:58:05 GMT
conor       2003/04/14 04:58:04

  Modified:    .        check.xml
               src/main/org/apache/tools/ant IntrospectionHelper.java
                        Project.java RuntimeConfigurable.java
               src/main/org/apache/tools/ant/filters BaseFilterReader.java
                        EscapeUnicode.java StripLineComments.java
               src/main/org/apache/tools/ant/filters/util
                        ChainReaderHelper.java
               src/main/org/apache/tools/ant/helper ProjectHelperImpl.java
               src/main/org/apache/tools/ant/taskdefs Parallel.java
  Log:
  style fixes
  
  Revision  Changes    Path
  1.5       +7 -7      ant/check.xml
  
  Index: check.xml
  ===================================================================
  RCS file: /home/cvs/ant/check.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -u -r1.4 -r1.5
  --- check.xml	8 Jan 2003 08:29:10 -0000	1.4
  +++ check.xml	14 Apr 2003 11:58:02 -0000	1.5
  @@ -6,10 +6,10 @@
     <target name="checkstyle">
       <taskdef name="checkstyle"
                classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"/>
  -    <checkstyle>
  -      <property key="checkstyle.header.file" file="src/etc/RequiredHeader.txt"/>
  -      <property key="checkstyle.header.ignoreline" value="4"/>
  -      <property key="checkstyle.javadoc.scope" value="${javadoc.scope}"/>
  +    <checkstyle headerFile="src/etc/RequiredHeader.txt"
  +                headerIgnoreLine="4"
  +                allowProtected="true"
  +                javadocScope="${javadoc.scope}">
         <fileset dir="${java.dir}">
           <include name="${tocheck}"/>
         </fileset>
  
  
  
  1.52      +1 -2      ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
  
  Index: IntrospectionHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -w -u -r1.51 -r1.52
  --- IntrospectionHelper.java	6 Apr 2003 09:30:56 -0000	1.51
  +++ IntrospectionHelper.java	14 Apr 2003 11:58:03 -0000	1.52
  @@ -436,8 +436,7 @@
                   DynamicConfigurator dc = (DynamicConfigurator) element;
                   dc.setDynamicAttribute(attributeName, value);
                   return;
  -            }
  -            else {
  +            } else {
                   String msg = getElementName(p, element) +
                       " doesn't support the \"" + attributeName +
                       "\" attribute.";
  
  
  
  1.134     +49 -34    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.133
  retrieving revision 1.134
  diff -u -w -u -r1.133 -r1.134
  --- Project.java	3 Apr 2003 14:44:01 -0000	1.133
  +++ Project.java	14 Apr 2003 11:58:03 -0000	1.134
  @@ -903,8 +903,7 @@
                           && oldLoader instanceof AntClassLoader
                           && newLoader instanceof AntClassLoader
                           && ((AntClassLoader) oldLoader).getClasspath()
  -                        .equals(((AntClassLoader) newLoader).getClasspath())
  -                        ) {
  +                        .equals(((AntClassLoader) newLoader).getClasspath())) {
                           // same classname loaded from the same
                           // classpath components
                           logLevel = MSG_VERBOSE;
  @@ -2171,7 +2170,7 @@
       // Should move to a separate public class - and have API to add
       // listeners, etc.
       private static class AntRefTable extends Hashtable {
  -        Project project;
  +        private Project project;
           public AntRefTable(Project project) {
               super();
               this.project = project;
  @@ -2212,9 +2211,9 @@
       }
   
       private static class AntTaskTable extends LazyHashtable {
  -        Project project;
  -        Properties props;
  -        boolean tasks = false;
  +        private Project project;
  +        private Properties props;
  +        private boolean tasks = false;
   
           public AntTaskTable(Project p, boolean tasks) {
               this.project = p;
  @@ -2226,26 +2225,33 @@
           }
   
           protected void initAll() {
  -            if (initAllDone ) return;
  +            if (initAllDone) {
  +                return;
  +            }
               project.log("InitAll", Project.MSG_DEBUG);
  -            if (props==null ) return;
  +            if (props == null) {
  +                return;
  +            }
               Enumeration enum = props.propertyNames();
               while (enum.hasMoreElements()) {
                   String key = (String) enum.nextElement();
                   Class taskClass=getTask( key );
                   if (taskClass!=null ) {
                       // This will call a get() and a put()
  -                    if (tasks )
  +                    if (tasks) {
                           project.addTaskDefinition(key, taskClass);
  -                    else
  +                    } else {
                           project.addDataTypeDefinition(key, taskClass );
                   }
               }
  +            }
               initAllDone=true;
           }
   
           protected Class getTask(String key) {
  -            if (props==null ) return null; // for tasks loaded before init()
  +            if (props == null) {
  +                return null; // for tasks loaded before init()
  +            }
               String value=props.getProperty(key);
               if (value==null) {
                   //project.log( "No class name for " + key, Project.MSG_VERBOSE );
  @@ -2257,15 +2263,19 @@
                       !("only".equals(project.getProperty("build.sysclasspath")))) {
                       try {
                           taskClass=project.getCoreLoader().loadClass(value);
  -                        if (taskClass != null ) return taskClass;
  +                        if (taskClass != null) {
  +                            return taskClass;
  +                        }
                       } catch( Exception ex ) {
  +                        // ignore
                       }
                   }
                   taskClass = Class.forName(value);
                   return taskClass;
               } catch (NoClassDefFoundError ncdfe) {
                   project.log("Could not load a dependent class ("
  -                        + ncdfe.getMessage() + ") for task " + key, Project.MSG_DEBUG);
  +                        + ncdfe.getMessage() + ") for task " 
  +                        + key, Project.MSG_DEBUG);
               } catch (ClassNotFoundException cnfe) {
                   project.log("Could not load class (" + value
                           + ") for task " + key, Project.MSG_DEBUG);
  @@ -2276,18 +2286,23 @@
           // Hashtable implementation
           public Object get( Object key ) {
               Object orig=super.get( key );
  -            if (orig!= null ) return orig;
  -            if (! (key instanceof String) ) return null;
  +            if (orig != null) {
  +                return orig;
  +            }
  +            if (!(key instanceof String)) {
  +                return null;
  +            }
  +            
               project.log("Get task " + key, Project.MSG_DEBUG );
               Object taskClass=getTask( (String) key);
  -            if (taskClass != null)
  +            if (taskClass != null) {
                   super.put( key, taskClass );
  +            }
               return taskClass;
           }
   
           public boolean containsKey(Object key) {
               return get(key) != null;
           }
  -
       }
   }
  
  
  
  1.31      +14 -0     ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
  
  Index: RuntimeConfigurable.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -w -u -r1.30 -r1.31
  --- RuntimeConfigurable.java	6 Apr 2003 09:30:56 -0000	1.30
  +++ RuntimeConfigurable.java	14 Apr 2003 11:58:03 -0000	1.31
  @@ -133,6 +133,12 @@
           proxyConfigured = false;
       }
   
  +    /**
  +     * Get the object for which this RuntimeConfigurable holds the configuration
  +     * information
  +     *
  +     * @return the object whose configure is held by this instance.
  +     */
       public Object getProxy() {
           return wrappedObject;
       }
  @@ -151,6 +157,12 @@
           }
       }
   
  +    /**
  +     * Set an attribute to a given value
  +     *
  +     * @param name the name of the attribute.
  +     * @param value the attribute's value.
  +     */
       public void setAttribute(String name, String value) {
           attributeNames.addElement(name);
           attributeMap.put(name, value);
  @@ -357,6 +369,8 @@
       
       /**
        * Reconfigure the element, even if it has already been configured.
  +     *
  +     * @param p the project instance for this configuration.
        */
       public void reconfigure(Project p) {
           proxyConfigured = false;
  
  
  
  1.12      +2 -1      ant/src/main/org/apache/tools/ant/filters/BaseFilterReader.java
  
  Index: BaseFilterReader.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/BaseFilterReader.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -u -r1.11 -r1.12
  --- BaseFilterReader.java	10 Feb 2003 14:13:31 -0000	1.11
  +++ BaseFilterReader.java	14 Apr 2003 11:58:03 -0000	1.12
  @@ -143,7 +143,8 @@
        * @exception  IllegalArgumentException  If <code>n</code> is negative.
        * @exception  IOException  If an I/O error occurs
        */
  -    public final long skip(final long n) throws IOException {
  +    public final long skip(final long n) 
  +        throws IOException, IllegalArgumentException {
           if (n < 0L) {
               throw new IllegalArgumentException("skip value is negative");
           }
  
  
  
  1.2       +6 -5      ant/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
  
  Index: EscapeUnicode.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/EscapeUnicode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -u -r1.1 -r1.2
  --- EscapeUnicode.java	14 Mar 2003 13:45:16 -0000	1.1
  +++ EscapeUnicode.java	14 Apr 2003 11:58:03 -0000	1.2
  @@ -66,7 +66,8 @@
    *
    * Or:
    *
  - * <pre>&lt;filterreader classname=&quot;org.apache.tools.ant.filters.EscapeUnicode&quot;/&gt;
  + * <pre>&lt;filterreader 
  +        classname=&quot;org.apache.tools.ant.filters.EscapeUnicode&quot;/&gt;
   *  </pre>
    *
    * @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a>
  @@ -107,7 +108,7 @@
        * @return the next character in the resulting stream, or -1
        * if the end of the resulting stream has been reached
        *
  -     * @exception java.io.IOException if the underlying stream throws
  +     * @exception IOException if the underlying stream throws
        * an IOException during reading
        */
       public final int read() throws IOException {
  
  
  
  1.9       +2 -1      ant/src/main/org/apache/tools/ant/filters/StripLineComments.java
  
  Index: StripLineComments.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/StripLineComments.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -u -r1.8 -r1.9
  --- StripLineComments.java	18 Feb 2003 14:06:22 -0000	1.8
  +++ StripLineComments.java	14 Apr 2003 11:58:03 -0000	1.9
  @@ -73,7 +73,8 @@
    *
    * Or:
    *
  - * <pre>&lt;filterreader classname=&quot;org.apache.tools.ant.filters.StripLineComments&quot;&gt;
  + * <pre>&lt;filterreader 
  + *      classname=&quot;org.apache.tools.ant.filters.StripLineComments&quot;&gt;
    *   &lt;param type=&quot;comment&quot; value="#&quot;/&gt;
    *   &lt;param type=&quot;comment&quot; value=&quot;--&quot;/&gt;
    *   &lt;param type=&quot;comment&quot; value=&quot;REM &quot;/&gt;
  
  
  
  1.11      +2 -1      ant/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
  
  Index: ChainReaderHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -u -r1.10 -r1.11
  --- ChainReaderHelper.java	10 Feb 2003 14:13:33 -0000	1.10
  +++ ChainReaderHelper.java	14 Apr 2003 11:58:03 -0000	1.11
  @@ -161,7 +161,8 @@
                   Object o = finalFilters.elementAt(i);
   
                   if (o instanceof AntFilterReader) {
  -                    final AntFilterReader filter = (AntFilterReader) finalFilters.elementAt(i);
  +                    final AntFilterReader filter 
  +                        = (AntFilterReader) finalFilters.elementAt(i);
                       final String className = filter.getClassName();
                       final Path classpath = filter.getClasspath();
                       final Project project = filter.getProject();
  
  
  
  1.18      +2 -1      ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
  
  Index: ProjectHelperImpl.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -u -r1.17 -r1.18
  --- ProjectHelperImpl.java	10 Feb 2003 14:13:33 -0000	1.17
  +++ ProjectHelperImpl.java	14 Apr 2003 11:58:04 -0000	1.18
  @@ -135,7 +135,8 @@
        */
       public void parse(Project project, Object source) throws BuildException {
           if (!(source instanceof File)) {
  -            throw new BuildException("Only File source supported by default plugin");
  +            throw new BuildException("Only File source supported by " 
  +                + "default plugin");
           }
           File buildFile = (File) source;
           FileInputStream inputStream = null;
  
  
  
  1.17      +26 -9     ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java
  
  Index: Parallel.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Parallel.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -u -r1.16 -r1.17
  --- Parallel.java	7 Apr 2003 14:47:02 -0000	1.16
  +++ Parallel.java	14 Apr 2003 11:58:04 -0000	1.17
  @@ -92,19 +92,19 @@
       private final Object semaphore = new Object();
       
       /** Total number of threads to run */
  -    int numThreads = 0;
  +    private int numThreads = 0;
       
       /** Total number of threads per processor to run.  */
  -    int numThreadsPerProcessor = 0;
  +    private int numThreadsPerProcessor = 0;
       
       /** Interval (in ms) to poll for finished threads. */
  -    int pollInterval = 1000; // default is once a second
  +    private int pollInterval = 1000; // default is once a second
   
       /**
        * Add a nested task to execute in parallel.
        * @param nestedTask  Nested task to be executed in parallel
        */
  -    public void addTask(Task nestedTask) throws BuildException {
  +    public void addTask(Task nestedTask) {
           nestedTasks.addElement(nestedTask);
       }
       
  @@ -128,7 +128,8 @@
        * simultaneously.  If there are less tasks than threads then all will be 
        * executed at once, if there are more then only <code>threadCount</code>

        * tasks will be executed at one time.  If <code>threadsPerProcessor</code>

  -     * is set and the JVM is at least a 1.4 VM then this value is ignormed.; optional
  +     * is set and the JVM is at least a 1.4 VM then this value is 
  +     * ignored.; optional
        *
        * @param numThreads total number of therads.
        *
  @@ -147,6 +148,11 @@
           this.pollInterval = pollInterval;
       }
       
  +    /**
  +     * Execute the parallel tasks
  +     *
  +     * @exception BuildException if any of the threads failed.
  +     */
       public void execute() throws BuildException {
           updateThreadCounts();
           if (numThreads == 0) {
  @@ -155,6 +161,9 @@
           spinThreads();
       }
       
  +    /**
  +     * Determine the number of threads based on the number of processors
  +     */
       private void updateThreadCounts() {
           if (numThreadsPerProcessor != 0) {
               int numProcessors = getNumProcessors();
  @@ -165,7 +174,9 @@
       }
           
       /**
  -     * Spin up threadCount threads.
  +     * Spin up required threads with a maximum number active at any given time.
  +     *
  +     * @exception BuildException if any of the threads failed.
        */
       private void spinThreads() throws BuildException {
           final int numTasks = nestedTasks.size();
  @@ -194,7 +205,8 @@
                       if (running[i] == null || !running[i].isAlive()) {
                           running[i] = threads[threadNumber++];
                           running[i].start();
  -                        // countinue on outer while loop in case we used our last thread
  +                        // countinue on outer while loop in case we 
  +                        // used our last thread
                           continue outer;
                       }
                   }
  @@ -253,6 +265,11 @@
           }
       }
           
  +    /**
  +     * Determine the number of processors. Only effective on later VMs
  +     *
  +     * @return the number of processors available or 0 if not determinable.
  +     */
       private int getNumProcessors() {
           try {
               Class[] paramTypes = {};
  
  
  

Mime
View raw message