You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/11/21 22:05:57 UTC
svn commit: r1641001 - in /tomcat/tc8.0.x/trunk: ./
test/org/apache/tomcat/util/bcel/TesterPerformance.java
Author: kkolinko
Date: Fri Nov 21 21:05:57 2014
New Revision: 1641001
URL: http://svn.apache.org/r1641001
Log:
Close Jars opened during a test.
Merged r1641000 from tomcat/trunk.
Modified:
tomcat/tc8.0.x/trunk/ (props changed)
tomcat/tc8.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
Propchange: tomcat/tc8.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1641000
Modified: tomcat/tc8.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1641001&r1=1641000&r2=1641001&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java (original)
+++ tomcat/tc8.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java Fri Nov 21 21:05:57 2014
@@ -51,22 +51,23 @@ public class TesterPerformance {
long duration = 0;
for (URL jarURL : jarURLs) {
- Jar jar = JarFactory.newInstance(jarURL);
- jar.nextEntry();
- String jarEntryName = jar.getEntryName();
- while (jarEntryName != null) {
- if (jarEntryName.endsWith(".class")) {
- InputStream is = jar.getEntryInputStream();
- long start = System.nanoTime();
- ClassParser cp = new ClassParser(is);
- cp.parse();
- duration += System.nanoTime() - start;
- }
+ try (Jar jar = JarFactory.newInstance(jarURL)) {
jar.nextEntry();
- jarEntryName = jar.getEntryName();
+ String jarEntryName = jar.getEntryName();
+ while (jarEntryName != null) {
+ if (jarEntryName.endsWith(".class")) {
+ InputStream is = jar.getEntryInputStream();
+ long start = System.nanoTime();
+ ClassParser cp = new ClassParser(is);
+ cp.parse();
+ duration += System.nanoTime() - start;
+ }
+ jar.nextEntry();
+ jarEntryName = jar.getEntryName();
+ }
}
}
- System.out.println("ClassParser performance test took: " + duration + "ns");
+ System.out.println("ClassParser performance test took: " + duration + " ns");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org