classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please test lazy zip changes


From: Mark Wielaard
Subject: Please test lazy zip changes
Date: 29 Nov 2002 15:14:08 +0100

Hi,

I just committed the following patch that makes reading of zip entries
or Manifest files "lazy", meaning that it is done only when needed. Also
the creation of the Calendar object and conversion from/to dos time is
now only done when get/setTime is called on the ZipEntry. The actual
ZipEntries are now stored in a Hashtable to make getEntry(String) more
efficient (especially important when an an entry cannot be found in a
large zip file). This was needed for merging URLClassLoader with libgcj
since they use an instance of URLClassLoader as their bootstrap loader
and in particular the resolving of all the Calendar classes and
resources during class loading did not play nice together.

It should also help VMs that use an instance of URLClassLoader as their
application ClassLoader when a lot of jar/zip files are given on the
classpath since they are now not opened all at once when the application
starts up. (Although as soon as a class or resource is requested that
cannot be found in any of the jar/zip files they are still all opened
and searched of course.)

The patch has been tested with Kissme and Mauve (and of course with gcj)
to see that there were no regressions (but I believe Kissme uses a
native zip implementation for reading jar/zip files from the classpath).

        * java/util/jar/JarFile.java (manifest): Not final.
        (manifestRead): New field.
        (JarFile): Don't read Manifest in constructor.
        (getManifest): New method.
        (JarEnumeration.nextElement): Use new method.
        (getEntry): Likewise.
        * java/util/zip/ZipFile.java (name): Final.
        (raf): Likewsie.
        (entries): Change type to Hashtable.
        (closed): New field.
        (ZipFile): Don't read enties in constructor.
        (readEntries): Use Hashtable.
        (close): Set new close flag and set entries to null inside
        synchronized block.
        (entries): Contruct enumeration using new getEntries() method and
        entries Hashtable.
        (getEntryIndex): Removed.
        (getEntries): New method.
        (getEntry): Use new getEntries() method and entries Hastable.
        (getInputStream): Likewise.
        (size): Return getEntries().size().
        (ZipEntryEnumeration): Wrap entries Hashtable elements.
        * java/util/zip/ZipEntry.java (cal): Don't initialize.
        (time): Removed
        (dostime): New field.
        (zipFileIndex): Removed.
        (ZipEntry(ZipEntry)): Copy dostime.
        (setDOSTime): Now final and doesn't convert dos time.
        (getDOSTime): Likewise.
        (setTime): Convert dos time.
        (getTime): Likewise.
        (getCalendar): New method.
        (setExtra): Use setTime().
        * java/util/zip/ZipInputStream.java (getNextEntry): Format error msg.

The actual patch can also be found on the libgcj patches mailing list:
http://gcc.gnu.org/ml/java-patches/2002-q4/msg00294.html

Cheers,

Mark





reply via email to

[Prev in Thread] Current Thread [Next in Thread]