Commit 2ab62eb
committed
Improve PlexusIoZipFileResourceCollection performance by using JarFile
Currently `PlexusIoZipFileResourceCollection` uses `PlexusIoURLResource`
to get the `InputStream` of the JAR entries. `PlexusIoURLResource`
uses `URL` and `URLConnection` to get the input stream. The problem is
that they create a new `JarFile` for every entry and in some cases
the `JarFile` initialization could be expensive
(for example when he JAR is signed). Using the `URLConnection`
cache would solve the performance issues but opens new one.
The cache is global for the build so if the JAR file have changed
during the build you may get the cached instance (see plexus-io#2).
Modify `PlexusIoZipFileResourceCollection` to use `JarFile`
directly instead of using `PlexusIoURLResource`.
That would solve solves the two issues - `JarFile` is initialized once
so there is no performance penalty and it is local so if the file
changed during the build the latest version will be picked up.
Under the hood `PlexusIoURLResource` uses `JarFile` as well
and keeping `ZipFileResource` extending `PlexusIoURLResource` would
both keep the behaviour and interface backward compatible.
Closes #1061 parent c277286 commit 2ab62eb
File tree
1 file changed
+42
-8
lines changed- src/main/java/org/codehaus/plexus/archiver/zip
1 file changed
+42
-8
lines changedLines changed: 42 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | | - | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| 102 | + | |
99 | 103 | | |
100 | | - | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
107 | 131 | | |
108 | 132 | | |
109 | 133 | | |
| |||
131 | 155 | | |
132 | 156 | | |
133 | 157 | | |
134 | | - | |
| 158 | + | |
135 | 159 | | |
136 | | - | |
| 160 | + | |
137 | 161 | | |
138 | 162 | | |
139 | 163 | | |
| |||
157 | 181 | | |
158 | 182 | | |
159 | 183 | | |
| 184 | + | |
| 185 | + | |
160 | 186 | | |
161 | 187 | | |
162 | 188 | | |
163 | 189 | | |
164 | | - | |
| 190 | + | |
165 | 191 | | |
166 | 192 | | |
167 | 193 | | |
168 | 194 | | |
| 195 | + | |
169 | 196 | | |
170 | 197 | | |
171 | 198 | | |
| |||
181 | 208 | | |
182 | 209 | | |
183 | 210 | | |
184 | | - | |
185 | | - | |
| 211 | + | |
| 212 | + | |
186 | 213 | | |
187 | 214 | | |
188 | 215 | | |
| |||
202 | 229 | | |
203 | 230 | | |
204 | 231 | | |
205 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
206 | 240 | | |
207 | 241 | | |
208 | 242 | | |
| |||
0 commit comments