ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant Project.java
Date Tue, 29 Mar 2005 21:46:36 GMT
jglick      2005/03/29 13:46:36

  Modified:    src/main/org/apache/tools/ant Project.java
  Log:
  Avoid hypothetical memory leak by not holding a strong reference to the thread or thread
groups used as keys to
  report task associations.
  
  Revision  Changes    Path
  1.190     +7 -4      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.189
  retrieving revision 1.190
  diff -u -r1.189 -r1.190
  --- Project.java	29 Mar 2005 19:56:15 -0000	1.189
  +++ Project.java	29 Mar 2005 21:46:36 -0000	1.190
  @@ -23,6 +23,7 @@
   import java.io.InputStream;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  +import java.util.Collections;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Iterator;
  @@ -31,6 +32,8 @@
   import java.util.Vector;
   import java.util.Set;
   import java.util.HashSet;
  +import java.util.Map;
  +import java.util.WeakHashMap;
   import org.apache.tools.ant.input.DefaultInputHandler;
   import org.apache.tools.ant.input.InputHandler;
   import org.apache.tools.ant.helper.DefaultExecutor;
  @@ -157,11 +160,11 @@
        */
       private ClassLoader coreLoader = null;
   
  -    /** Records the latest task to be executed on a thread (Thread to Task). */
  -    private Hashtable threadTasks = new Hashtable();
  +    /** Records the latest task to be executed on a thread. */
  +    private Map/*<Thread,Task>*/ threadTasks = Collections.synchronizedMap(new WeakHashMap());
   
  -    /** Records the latest task to be executed on a thread Group. */
  -    private Hashtable threadGroupTasks = new Hashtable();
  +    /** Records the latest task to be executed on a thread group. */
  +    private Map/*<ThreadGroup,Task>*/ threadGroupTasks = Collections.synchronizedMap(new
WeakHashMap());
   
       /**
        * Called to handle any input requests.
  
  
  

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


Mime
View raw message