Author: remy.maucherat(a)jboss.com
Date: 2008-07-23 08:43:59 -0400 (Wed, 23 Jul 2008)
New Revision: 725
Modified:
trunk/java/org/apache/jasper/Constants.java
trunk/java/org/apache/jasper/compiler/Generator.java
trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
trunk/webapps/docs/changelog.xml
trunk/webapps/docs/sysprops.xml
Log:
- Add system property to disable tag injection.
Modified: trunk/java/org/apache/jasper/Constants.java
===================================================================
--- trunk/java/org/apache/jasper/Constants.java 2008-07-22 14:04:03 UTC (rev 724)
+++ trunk/java/org/apache/jasper/Constants.java 2008-07-23 12:43:59 UTC (rev 725)
@@ -196,6 +196,9 @@
public static final boolean USE_INSTANCE_MANAGER_FOR_TAGS =
Boolean.valueOf(System.getProperty("org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS",
"false")).booleanValue();
+ public static final boolean INJECT_TAGS =
+
Boolean.valueOf(System.getProperty("org.apache.jasper.Constants.INJECT_TAGS",
"true")).booleanValue();
+
/**
* The name of the path parameter used to pass the session identifier
* back and forth with the client.
Modified: trunk/java/org/apache/jasper/compiler/Generator.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Generator.java 2008-07-22 14:04:03 UTC (rev
724)
+++ trunk/java/org/apache/jasper/compiler/Generator.java 2008-07-23 12:43:59 UTC (rev
725)
@@ -2252,18 +2252,22 @@
out.print("new ");
out.print(tagHandlerClassName);
out.println("());");
- out.printin(VAR_INSTANCEMANAGER);
- out.print(".newInstance(");
- out.print(tagHandlerVar);
- out.println(");");
+ if (Constants.INJECT_TAGS) {
+ out.printin(VAR_INSTANCEMANAGER);
+ out.print(".newInstance(");
+ out.print(tagHandlerVar);
+ out.println(");");
+ }
}
}
private void writeDestroyInstance(String tagHandlerVar) {
- out.printin(VAR_INSTANCEMANAGER);
- out.print(".destroyInstance(");
- out.print(tagHandlerVar);
- out.println(");");
+ if (Constants.INJECT_TAGS) {
+ out.printin(VAR_INSTANCEMANAGER);
+ out.print(".destroyInstance(");
+ out.print(tagHandlerVar);
+ out.println(");");
+ }
}
private void generateCustomEnd(Node.CustomTag n, String tagHandlerVar,
Modified: trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2008-07-22 14:04:03 UTC (rev
724)
+++ trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2008-07-23 12:43:59 UTC (rev
725)
@@ -126,7 +126,9 @@
return (Tag) instanceManager.newInstance(handlerClass.getName(),
handlerClass.getClassLoader());
} else {
Tag instance = (Tag) handlerClass.newInstance();
- instanceManager.newInstance(instance);
+ if (Constants.INJECT_TAGS) {
+ instanceManager.newInstance(instance);
+ }
return instance;
}
} catch (Exception e) {
@@ -150,11 +152,13 @@
}
// There is no need for other threads to wait for us to release
handler.release();
- try {
- instanceManager.destroyInstance(handler);
- } catch (Exception e) {
- log.warn("Error processing preDestroy on tag instance of "
- + handler.getClass().getName(), e);
+ if (Constants.INJECT_TAGS) {
+ try {
+ instanceManager.destroyInstance(handler);
+ } catch (Exception e) {
+ log.warn("Error processing preDestroy on tag instance of "
+ + handler.getClass().getName(), e);
+ }
}
}
@@ -165,11 +169,13 @@
public synchronized void release() {
for (int i = current; i >= 0; i--) {
handlers[i].release();
- try {
- instanceManager.destroyInstance(handlers[i]);
- } catch (Exception e) {
- log.warn("Error processing preDestroy on tag instance of "
- + handlers[i].getClass().getName(), e);
+ if (Constants.INJECT_TAGS) {
+ try {
+ instanceManager.destroyInstance(handlers[i]);
+ } catch (Exception e) {
+ log.warn("Error processing preDestroy on tag instance of "
+ + handlers[i].getClass().getName(), e);
+ }
}
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-07-22 14:04:03 UTC (rev 724)
+++ trunk/webapps/docs/changelog.xml 2008-07-23 12:43:59 UTC (rev 725)
@@ -73,6 +73,9 @@
<jira>110</jira>: Remove the per request logging of everything in JSP
Servlet, which caused
i18n issues. (remm)
</fix>
+ <update>
+ Add a system property to disable injection for tags. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Native">
Modified: trunk/webapps/docs/sysprops.xml
===================================================================
--- trunk/webapps/docs/sysprops.xml 2008-07-22 14:04:03 UTC (rev 724)
+++ trunk/webapps/docs/sysprops.xml 2008-07-23 12:43:59 UTC (rev 725)
@@ -239,6 +239,12 @@
handler instances. If not specified, <code>false</code> will be
used.</p>
</property>
+ <property name="org.apache.jasper.Constants.
USE_INSTANCE_MANAGER_FOR_TAGS">
+ <p>If <code>true</code>, annotations specified in tags will be
processed and
+ injected. This can have a performance impact when using simple tags, or if tag
+ pooling is disabled. If not specified, <code>true</code> will be
used.</p>
+ </property>
+
</properties>
</section>
Show replies by date