Author: markt
Date: Fri Mar 11 16:54:04 2016
New Revision: 1734592
URL: http://svn.apache.org/viewvc?rev=1734592&view=rev
Log:
Speed up ImportHandler some more.
Modified:
tomcat/trunk/java/javax/el/ImportHandler.java
Modified: tomcat/trunk/java/javax/el/ImportHandler.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ImportHandler.java?rev=1734592&r1=1734591&r2=1734592&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ImportHandler.java (original)
+++ tomcat/trunk/java/javax/el/ImportHandler.java Fri Mar 11 16:54:04 2016
@@ -191,8 +191,23 @@ public class ImportHandler {
private Class<?> findClass(String name, boolean throwException) {
Class<?> clazz;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ String path = name.replace(".", "/");
try {
- clazz = cl.loadClass(name);
+ /* Given that findClass() has to be called for every imported
+ * package and that getResource() is a lot faster then loadClass()
+ * for resources that don't exist, the overhead of the
getResource()
+ * for the case where the class does exist is a lot less than the
+ * overhead we save by not calling loadClass().
+ */
+ if (cl.getResource(path) == null) {
+ return null;
+ }
+ } catch (ClassCircularityError cce) {
+ // May happen under a security manager. Ignore it and try loading
+ // the class normally.
+ }
+ try {
+ clazz = cl.loadClass(name);
} catch (ClassNotFoundException e) {
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]