commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip ZipFileSystem.java
Date Thu, 27 Jan 2005 08:06:11 GMT
imario      2005/01/27 00:06:11

  Modified:    vfs/src/java/org/apache/commons/vfs/provider
                        AbstractFileObject.java
               vfs/src/java/org/apache/commons/vfs/provider/tar
                        TarFileSystem.java
               vfs/src/java/org/apache/commons/vfs/provider/zip
                        ZipFileSystem.java
  Log:
  hold strong reference of archive children on every children.
  Thus they should only be garbage collected if you do not hold a strong reference to any
of the children.
  
  Revision  Changes    Path
  1.54      +1 -1      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
  
  Index: AbstractFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- AbstractFileObject.java	27 Jan 2005 07:15:49 -0000	1.53
  +++ AbstractFileObject.java	27 Jan 2005 08:06:11 -0000	1.54
  @@ -1451,7 +1451,7 @@
        * This method is meant to add a object where this object holds a strong reference
then.
        * E.g. a archive-filesystem creates a list of all childs and they shouldnt get
        * garbage collected until the container is garbage collected
  -     * 
  +     *
        * @param strongRef
        */
       public void holdObject(Object strongRef)
  
  
  
  1.5       +3 -3      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java
  
  Index: TarFileSystem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TarFileSystem.java	27 Jan 2005 07:33:08 -0000	1.4
  +++ TarFileSystem.java	27 Jan 2005 08:06:11 -0000	1.5
  @@ -100,6 +100,7 @@
                   fileObj = createTarFileObject(name, entry);
                   putFileToCache(fileObj);
                   strongRef.add(fileObj);
  +                fileObj.holdObject(strongRef);
   
                   // Make sure all ancestors exist
                   // TODO - create these on demand
  @@ -115,14 +116,13 @@
                           parent = createTarFileObject(parentName, null);
                           putFileToCache(parent);
                           strongRef.add(parent);
  +                        parent.holdObject(strongRef);
                       }
   
                       // Attach child to parent
                       parent.attachChild(fileObj.getName());
                   }
               }
  -
  -            ((AbstractFileObject) getParentLayer()).holdObject(strongRef);
           }
           catch (IOException e)
           {
  
  
  
  1.34      +2 -1      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
  
  Index: ZipFileSystem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ZipFileSystem.java	27 Jan 2005 07:33:08 -0000	1.33
  +++ ZipFileSystem.java	27 Jan 2005 08:06:11 -0000	1.34
  @@ -96,6 +96,7 @@
               fileObj = createZipFileObject(name, entry);
               putFileToCache(fileObj);
               strongRef.add(fileObj);
  +            fileObj.holdObject(strongRef);
   
               // Make sure all ancestors exist
               // TODO - create these on demand
  @@ -111,13 +112,13 @@
                       parent = createZipFileObject(parentName, null);
                       putFileToCache(parent);
                       strongRef.add(parent);
  +                    parent.holdObject(strongRef);
                   }
   
                   // Attach child to parent
                   parent.attachChild(fileObj.getName());
               }
           }
  -        ((AbstractFileObject) getParentLayer()).holdObject(strongRef);
       }
   
       protected ZipFile getZipFile() throws FileSystemException
  
  
  

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


Mime
View raw message