geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r784303 [2/2] - in /geronimo/external/trunk/tomcat-parent-6.0.18: ./ catalina-ha/src/main/java/org/apache/catalina/ha/ catalina/src/main/java/org/apache/catalina/ catalina/src/main/java/org/apache/catalina/core/ catalina/src/main/java/org/a...
Date Fri, 12 Jun 2009 22:47:34 GMT
Modified: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java
(original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/runtime/TagHandlerPool.java
Fri Jun 12 22:47:32 2009
@@ -21,7 +21,7 @@
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.jasper.Constants;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -42,7 +42,7 @@
     
     // index of next available tag handler
     private int current;
-    protected AnnotationProcessor annotationProcessor = null;
+    protected InstanceManager instanceManager = null;
 
     public static TagHandlerPool getTagHandlerPool( ServletConfig config) {
         TagHandlerPool result=null;
@@ -78,8 +78,7 @@
         }
         this.handlers = new Tag[maxSize];
         this.current = -1;
-        this.annotationProcessor = 
-            (AnnotationProcessor) config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
+        instanceManager = InstanceManagerFactory.getInstanceManager(config);
     }
 
     /**
@@ -112,7 +111,7 @@
      * @throws JspException if a tag handler cannot be instantiated
      */
     public Tag get(Class handlerClass) throws JspException {
-	Tag handler = null;
+    	Tag handler;
         synchronized( this ) {
             if (current >= 0) {
                 handler = handlers[current--];
@@ -123,9 +122,13 @@
         // Out of sync block - there is no need for other threads to
         // wait for us to construct a tag for this thread.
         try {
-            Tag instance = (Tag) handlerClass.newInstance();
-            AnnotationHelper.postConstruct(annotationProcessor, instance);
-            return instance;
+        	if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
+        		return (Tag) instanceManager.newInstance(handlerClass.getName(), handlerClass.getClassLoader());
+        	} else {
+                Tag instance = (Tag) handlerClass.newInstance();
+                instanceManager.newInstance(instance);
+                return instance;
+        	}
         } catch (Exception e) {
             throw new JspException(e.getMessage(), e);
         }
@@ -147,13 +150,11 @@
         }
         // There is no need for other threads to wait for us to release
         handler.release();
-        if (annotationProcessor != null) {
-            try {
-                AnnotationHelper.preDestroy(annotationProcessor, handler);
-            } catch (Exception e) {
-                log.warn("Error processing preDestroy on tag instance of " 
-                        + handler.getClass().getName(), e);
-            }
+        try {
+            instanceManager.destroyInstance(handler);
+        } catch (Exception e) {
+            log.warn("Error processing preDestroy on tag instance of "
+                    + handler.getClass().getName(), e);
         }
     }
 
@@ -164,13 +165,11 @@
     public synchronized void release() {
         for (int i = current; i >= 0; i--) {
             handlers[i].release();
-            if (annotationProcessor != null) {
-                try {
-                    AnnotationHelper.preDestroy(annotationProcessor, handlers[i]);
-                } catch (Exception e) {
-                    log.warn("Error processing preDestroy on tag instance of " 
-                            + handlers[i].getClass().getName(), e);
-                }
+            try {
+                instanceManager.destroyInstance(handlers[i]);
+            } catch (Exception e) {
+                log.warn("Error processing preDestroy on tag instance of "
+                        + handlers[i].getClass().getName(), e);
             }
         }
     }

Modified: geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=784303&r1=784302&r2=784303&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
(original)
+++ geronimo/external/trunk/tomcat-parent-6.0.18/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
Fri Jun 12 22:47:32 2009
@@ -31,7 +31,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.jsp.tagext.TagInfo;
 
-import org.apache.AnnotationProcessor;
+import org.apache.InstanceManager;
 import org.apache.jasper.JasperException;
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.Options;
@@ -39,6 +39,7 @@
 import org.apache.jasper.compiler.JavacErrorDetail;
 import org.apache.jasper.compiler.JspRuntimeContext;
 import org.apache.jasper.compiler.Localizer;
+import org.apache.jasper.runtime.InstanceManagerFactory;
 import org.apache.jasper.runtime.JspSourceDependent;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -68,7 +69,6 @@
 
     private Servlet theServlet;
     private String jspUri;
-    private Class servletClass;
     private Class tagHandlerClass;
     private JspCompilationContext ctxt;
     private long available = 0L;
@@ -139,15 +139,10 @@
                     destroy();
                     
                     Servlet servlet = null;
-                    
+
                     try {
-                        servletClass = ctxt.load();
-                        servlet = (Servlet) servletClass.newInstance();
-                        AnnotationProcessor annotationProcessor = (AnnotationProcessor) config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
-                        if (annotationProcessor != null) {
-                           annotationProcessor.processAnnotations(servlet);
-                           annotationProcessor.postConstruct(servlet);
-                        }
+                        InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
+                        servlet = (Servlet) instanceManager.newInstance(ctxt.getFQCN(), ctxt.getJspLoader());
                     } catch (IllegalAccessException e) {
                         throw new JasperException(e);
                     } catch (InstantiationException e) {
@@ -423,15 +418,13 @@
     public void destroy() {
         if (theServlet != null) {
             theServlet.destroy();
-            AnnotationProcessor annotationProcessor = (AnnotationProcessor) config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
-            if (annotationProcessor != null) {
-                try {
-                    annotationProcessor.preDestroy(theServlet);
-                } catch (Exception e) {
-                    // Log any exception, since it can't be passed along
-                    log.error(Localizer.getMessage("jsp.error.file.not.found",
-                           e.getMessage()), e);
-                }
+            InstanceManager instanceManager = InstanceManagerFactory.getInstanceManager(config);
+            try {
+                instanceManager.destroyInstance(theServlet);
+            } catch (Exception e) {
+                // Log any exception, since it can't be passed along
+                log.error(Localizer.getMessage("jsp.error.file.not.found",
+                        e.getMessage()), e);
             }
         }
     }

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/juli/src/main/java/org/apache/juli/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/juli/src/main/java/org/apache/juli:783483-783555
 /tomcat/trunk/java/org/apache/juli:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/shared/src/main/java/org/apache/PeriodicEventListener.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/shared/src/main/java/org/apache/PeriodicEventListener.java:783483-783555
 /tomcat/trunk/java/org/apache/PeriodicEventListener.java:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/tribes/src/main/java/org/apache/catalina/tribes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/tribes/src/main/java/org/apache/catalina/tribes:783483-783555
 /tomcat/trunk/java/org/apache/catalina/tribes:673796,673820

Propchange: geronimo/external/trunk/tomcat-parent-6.0.18/util/src/main/java/org/apache/tomcat/util/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 12 22:47:32 2009
@@ -1 +1,2 @@
+/geronimo/sandbox/djencks/tomcat/branches/tomcat-parent-6.0.18/util/src/main/java/org/apache/tomcat/util:783483-783555
 /tomcat/trunk/java/org/apache/tomcat/util:673796,673820



Mime
View raw message