JBossWeb SVN: r974 - in trunk/java/org/apache/catalina: core and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-31 14:16:24 -0400 (Tue, 31 Mar 2009)
New Revision: 974
Modified:
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/ApplicationContext.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
Log:
- Add some simple impl.
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-03-27 15:43:53 UTC (rev 973)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-03-31 18:16:24 UTC (rev 974)
@@ -2772,16 +2772,15 @@
setTimeout((timeout > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) timeout);
}
- @Override
public AsyncContext startAsync() throws IllegalStateException {
- // TODO Auto-generated method stub
- return null;
+ return startAsync(getRequest(), response.getResponse());
}
- @Override
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) throws IllegalStateException {
// TODO Auto-generated method stub
+ asyncMode = true;
+ eventMode = true;
return null;
}
Modified: trunk/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-27 15:43:53 UTC (rev 973)
+++ trunk/java/org/apache/catalina/core/ApplicationContext.java 2009-03-31 18:16:24 UTC (rev 974)
@@ -891,13 +891,13 @@
public ServletRegistration addServlet(String servletName,
Class<? extends Servlet> clazz) throws IllegalArgumentException,
IllegalStateException {
- // TODO Auto-generated method stub
- return null;
+ return addServlet(servletName, clazz.getName());
}
public boolean setInitParameter(String name, String value) {
- // TODO Auto-generated method stub
+ context.addParameter(name, value);
+ // FIXME: return value ?
return false;
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-27 15:43:53 UTC (rev 973)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-31 18:16:24 UTC (rev 974)
@@ -396,6 +396,10 @@
request.setAttribute
(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
requestPathMB);
+
+ // FIXME: Implement async mode, which means invoking listeners or the Servlet
+ // FIXME: Some async mode need creating a new filter chain
+
// Get the current (unchanged) filter chain for this request
ApplicationFilterChain filterChain =
(ApplicationFilterChain) request.getFilterChain();
15 years, 8 months
JBossWeb SVN: r973 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-27 11:43:53 -0400 (Fri, 27 Mar 2009)
New Revision: 973
Modified:
trunk/build.xml
trunk/dist.xml
trunk/webapps/docs/aio.xml
Log:
- Fix packaging.
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2009-03-27 15:12:28 UTC (rev 972)
+++ trunk/build.xml 2009-03-27 15:43:53 UTC (rev 973)
@@ -13,9 +13,9 @@
<!-- Project Properties -->
<property name="name" value="JBoss Web" />
- <property name="year" value="2008" />
- <property name="version.major" value="2" />
- <property name="version.minor" value="1" />
+ <property name="year" value="2009" />
+ <property name="version.major" value="3" />
+ <property name="version.minor" value="0" />
<property name="version.build" value="0" />
<property name="version.patch" value="0" />
<property name="version.tag" value="SNAPSHOT" />
@@ -208,7 +208,6 @@
<!-- Catalina Main JAR File -->
<jar jarfile="${catalina.jar}">
<fileset dir="${tomcat.classes}">
- <include name="org/apache/*" />
<include name="org/apache/catalina/**" />
<include name="org/apache/naming/**" />
<include name="org/jboss/servlet/http/**" />
@@ -243,6 +242,7 @@
<jar jarfile="${tomcat-coyote.jar}">
<fileset dir="${tomcat.classes}">
<include name="org/apache/coyote/**" />
+ <include name="org/apache/tomcat/*" />
<include name="org/apache/tomcat/jni/**" />
<include name="org/apache/tomcat/util/**" />
<!-- Javadoc and i18n exclusions -->
@@ -265,7 +265,6 @@
<!-- Jasper Implementation JAR File -->
<jar jarfile="${jasper.jar}">
<fileset dir="${tomcat.classes}">
- <include name="org/apache/*" />
<include name="org/apache/jasper/**" />
<!-- Javadoc and i18n exclusions -->
<exclude name="**/package.html" />
@@ -581,15 +580,12 @@
<!-- JBoss Web Main JAR File -->
<jar jarfile="${tomcat.jars}/jbossweb.jar" index="true">
<fileset dir="${tomcat.classes}">
- <include name="org/apache/*" />
<include name="org/apache/catalina/**" />
<exclude name="org/apache/catalina/startup/catalina.properties" />
<include name="org/apache/naming/**" />
<include name="org/apache/comet/**" />
<include name="org/apache/coyote/**" />
- <include name="org/apache/tomcat/bayeux/**" />
- <include name="org/apache/tomcat/jni/**" />
- <include name="org/apache/tomcat/util/**" />
+ <include name="org/apache/tomcat/**" />
<include name="org/apache/jasper/**" />
<include name="org/apache/cometd/bayeux/**" />
<include name="org/apache/el/**" />
Modified: trunk/dist.xml
===================================================================
--- trunk/dist.xml 2009-03-27 15:12:28 UTC (rev 972)
+++ trunk/dist.xml 2009-03-27 15:43:53 UTC (rev 973)
@@ -13,9 +13,9 @@
<!-- Project Properties -->
<property name="name" value="JBoss Web" />
- <property name="year" value="2008" />
- <property name="version.major" value="2" />
- <property name="version.minor" value="1" />
+ <property name="year" value="2009" />
+ <property name="version.major" value="3" />
+ <property name="version.minor" value="0" />
<property name="version.build" value="0" />
<property name="version.patch" value="0" />
<property name="version.tag" value="SNAPSHOT" />
@@ -170,6 +170,7 @@
<include name="org/apache/catalina/startup/DigesterFactory.class" />
<include name="org/apache/catalina/util/SchemaResolver.class" />
<include name="org/apache/catalina/util/StringManager.class" />
+ <include name="org/apache/tomcat/*" />
<include name="org/apache/tomcat/util/*" />
<include name="org/apache/tomcat/util/digester/*" />
<exclude name="**/package.html" />
Modified: trunk/webapps/docs/aio.xml
===================================================================
--- trunk/webapps/docs/aio.xml 2009-03-27 15:12:28 UTC (rev 972)
+++ trunk/webapps/docs/aio.xml 2009-03-27 15:43:53 UTC (rev 973)
@@ -210,6 +210,8 @@
the HttpEventFiler interface.
</p>
+ </subsection>
+
<subsection name="Servlet 3.0 Async">
<p>
@@ -218,6 +220,8 @@
implemented using the event functionality, and presented to the user through the Servlet API.
</p>
+ </subsection>
+
<!--subsection name="Tracking session and webapp lifecycle">
<p>
15 years, 9 months
JBossWeb SVN: r972 - in trunk: java/org/apache/catalina/core and 4 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-27 11:12:28 -0400 (Fri, 27 Mar 2009)
New Revision: 972
Added:
trunk/java/org/apache/tomcat/InstanceManager.java
trunk/java/org/apache/tomcat/PeriodicEventListener.java
Removed:
trunk/java/org/apache/AnnotationProcessor.java
trunk/java/org/apache/InstanceManager.java
trunk/java/org/apache/PeriodicEventListener.java
trunk/java/org/apache/tomcat/Apr.java
trunk/java/org/apache/tomcat/apr.properties
Modified:
trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/java/org/apache/catalina/core/StandardWrapper.java
trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
trunk/java/org/apache/jasper/servlet/JspServlet.java
trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
trunk/webapps/docs/changelog.xml
Log:
- Port move of classes to org.apache.tomcat.
Deleted: trunk/java/org/apache/AnnotationProcessor.java
===================================================================
--- trunk/java/org/apache/AnnotationProcessor.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/AnnotationProcessor.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.naming.NamingException;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision$
- * @deprecated Replaced by InstanceManager which provides a subset of the capabilities
- */
-public interface AnnotationProcessor {
- public void postConstruct(Object instance)
- throws IllegalAccessException, InvocationTargetException;
- public void preDestroy(Object instance)
- throws IllegalAccessException, InvocationTargetException;
- public void processAnnotations(Object instance)
- throws IllegalAccessException, InvocationTargetException, NamingException;
-}
Deleted: trunk/java/org/apache/InstanceManager.java
===================================================================
--- trunk/java/org/apache/InstanceManager.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/InstanceManager.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.naming.NamingException;
-
-/**
- * @version $Rev:$ $Date:$
- */
-public interface InstanceManager {
-
- public Object newInstance(String className)
- throws IllegalAccessException, InvocationTargetException, NamingException,
- InstantiationException, ClassNotFoundException;
-
- public Object newInstance(String fqcn, ClassLoader classLoader)
- throws IllegalAccessException, InvocationTargetException, NamingException,
- InstantiationException, ClassNotFoundException;
-
- public void newInstance(Object o)
- throws IllegalAccessException, InvocationTargetException, NamingException;
-
- public void destroyInstance(Object o)
- throws IllegalAccessException, InvocationTargetException;
-}
Deleted: trunk/java/org/apache/PeriodicEventListener.java
===================================================================
--- trunk/java/org/apache/PeriodicEventListener.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/PeriodicEventListener.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache;
-
-public interface PeriodicEventListener {
- /**
- * Execute a periodic task, such as reloading, etc.
- */
- public void periodicEvent();
-}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -32,13 +32,13 @@
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
-import org.apache.InstanceManager;
import org.apache.catalina.Context;
import org.apache.catalina.Globals;
import org.apache.catalina.deploy.FilterDef;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.StringManager;
+import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.util.log.SystemLogHandler;
Modified: trunk/java/org/apache/catalina/core/DefaultInstanceManager.java
===================================================================
--- trunk/java/org/apache/catalina/core/DefaultInstanceManager.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/catalina/core/DefaultInstanceManager.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -44,12 +44,12 @@
import javax.servlet.Filter;
import javax.servlet.Servlet;
-import org.apache.InstanceManager;
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.ContainerServlet;
import org.apache.catalina.Globals;
import org.apache.catalina.core.Constants;
import org.apache.catalina.util.StringManager;
+import org.apache.tomcat.InstanceManager;
/**
* @version $Rev$ $Date$
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -26,8 +26,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
@@ -64,8 +62,6 @@
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionListener;
-import org.apache.AnnotationProcessor;
-import org.apache.InstanceManager;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
@@ -106,6 +102,7 @@
import org.apache.naming.resources.FileDirContext;
import org.apache.naming.resources.ProxyDirContext;
import org.apache.naming.resources.WARDirContext;
+import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.util.modeler.Registry;
import org.jboss.logging.Logger;
@@ -193,12 +190,6 @@
/**
- * Dummy annotation processor.
- */
- private AnnotationProcessor annotationProcessor = new DummyAnnotationProcessor();
-
-
- /**
* The antiJARLocking flag for this Context.
*/
private boolean antiJARLocking = false;
@@ -4461,7 +4452,6 @@
} else {
getServletContext().setAttribute(InstanceManager.class.getName(), instanceManager);
}
- getServletContext().setAttribute(AnnotationProcessor.class.getName(), annotationProcessor);
}
try {
@@ -5855,28 +5845,4 @@
}
- // ----------------------------------------------- DummyAnnotationProcessor Inner Class
-
-
- protected class DummyAnnotationProcessor implements AnnotationProcessor {
-
- public void postConstruct(Object instance)
- throws IllegalAccessException, InvocationTargetException {
- // Do nothing
- }
-
- public void preDestroy(Object instance) throws IllegalAccessException,
- InvocationTargetException {
- getInstanceManager().destroyInstance(instance);
- }
-
- public void processAnnotations(Object instance)
- throws IllegalAccessException, InvocationTargetException,
- NamingException {
- getInstanceManager().newInstance(instance);
- }
-
- }
-
-
}
Modified: trunk/java/org/apache/catalina/core/StandardWrapper.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/catalina/core/StandardWrapper.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -44,8 +44,6 @@
import javax.servlet.SingleThreadModel;
import javax.servlet.UnavailableException;
-import org.apache.InstanceManager;
-import org.apache.PeriodicEventListener;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerServlet;
import org.apache.catalina.Context;
@@ -57,6 +55,8 @@
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.Enumerator;
import org.apache.catalina.util.InstanceSupport;
+import org.apache.tomcat.InstanceManager;
+import org.apache.tomcat.PeriodicEventListener;
import org.apache.tomcat.util.log.SystemLogHandler;
import org.apache.tomcat.util.modeler.Registry;
Modified: trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -22,10 +22,10 @@
import javax.servlet.ServletConfig;
-import org.apache.InstanceManager;
+import org.apache.tomcat.InstanceManager;
/**
- * @version $Rev:$ $Date:$
+ * @version $Rev$ $Date$
*/
public class InstanceManagerFactory {
Modified: trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
===================================================================
--- trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/jasper/runtime/TagHandlerPool.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -21,8 +21,8 @@
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;
-import org.apache.InstanceManager;
import org.apache.jasper.Constants;
+import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
import org.jboss.logging.Logger;
Modified: trunk/java/org/apache/jasper/servlet/JspServlet.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JspServlet.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/jasper/servlet/JspServlet.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -27,13 +27,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.PeriodicEventListener;
import org.apache.jasper.Constants;
import org.apache.jasper.EmbeddedServletOptions;
import org.apache.jasper.Options;
import org.apache.jasper.compiler.JspRuntimeContext;
import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.security.SecurityUtil;
+import org.apache.tomcat.PeriodicEventListener;
import org.jboss.logging.Logger;
/**
Modified: trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
===================================================================
--- trunk/java/org/apache/jasper/servlet/JspServletWrapper.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/jasper/servlet/JspServletWrapper.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -31,7 +31,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.tagext.TagInfo;
-import org.apache.InstanceManager;
import org.apache.jasper.JasperException;
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.Options;
@@ -41,6 +40,7 @@
import org.apache.jasper.compiler.Localizer;
import org.apache.jasper.runtime.InstanceManagerFactory;
import org.apache.jasper.runtime.JspSourceDependent;
+import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
import org.jboss.logging.Logger;
Deleted: trunk/java/org/apache/tomcat/Apr.java
===================================================================
--- trunk/java/org/apache/tomcat/Apr.java 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/tomcat/Apr.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.tomcat;
-
-import java.io.InputStream;
-import java.util.Properties;
-
-public class Apr {
- private static String aprInfo = null;
-
- static {
-
- try {
- InputStream is = Apr.class.getResourceAsStream
- ("/org/apache/tomcat/apr.properties");
- Properties props = new Properties();
- props.load(is);
- is.close();
- aprInfo = props.getProperty("tcn.info");
- }
- catch (Throwable t) {
- ; // Nothing
- }
- }
-}
Copied: trunk/java/org/apache/tomcat/InstanceManager.java (from rev 970, trunk/java/org/apache/InstanceManager.java)
===================================================================
--- trunk/java/org/apache/tomcat/InstanceManager.java (rev 0)
+++ trunk/java/org/apache/tomcat/InstanceManager.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.tomcat;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.naming.NamingException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface InstanceManager {
+
+ public Object newInstance(String className)
+ throws IllegalAccessException, InvocationTargetException, NamingException,
+ InstantiationException, ClassNotFoundException;
+
+ public Object newInstance(String fqcn, ClassLoader classLoader)
+ throws IllegalAccessException, InvocationTargetException, NamingException,
+ InstantiationException, ClassNotFoundException;
+
+ public void newInstance(Object o)
+ throws IllegalAccessException, InvocationTargetException, NamingException;
+
+ public void destroyInstance(Object o)
+ throws IllegalAccessException, InvocationTargetException;
+}
Property changes on: trunk/java/org/apache/tomcat/InstanceManager.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Copied: trunk/java/org/apache/tomcat/PeriodicEventListener.java (from rev 970, trunk/java/org/apache/PeriodicEventListener.java)
===================================================================
--- trunk/java/org/apache/tomcat/PeriodicEventListener.java (rev 0)
+++ trunk/java/org/apache/tomcat/PeriodicEventListener.java 2009-03-27 15:12:28 UTC (rev 972)
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tomcat;
+
+public interface PeriodicEventListener {
+ /**
+ * Execute a periodic task, such as reloading, etc.
+ */
+ public void periodicEvent();
+}
Property changes on: trunk/java/org/apache/tomcat/PeriodicEventListener.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Deleted: trunk/java/org/apache/tomcat/apr.properties
===================================================================
--- trunk/java/org/apache/tomcat/apr.properties 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/java/org/apache/tomcat/apr.properties 2009-03-27 15:12:28 UTC (rev 972)
@@ -1 +0,0 @@
-tcn.info=Tomcat Native/@VERSION@
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-27 13:54:49 UTC (rev 971)
+++ trunk/webapps/docs/changelog.xml 2009-03-27 15:12:28 UTC (rev 972)
@@ -44,6 +44,9 @@
<fix>
<bug>45332</bug>: Encoding fix for tomcat-users file. (markt)
</fix>
+ <update>
+ Move InstanceManager and PeriodicEventListener to org.apache.tomcat. (markt)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 9 months
JBossWeb SVN: r971 - in branches/2.1.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-27 09:54:49 -0400 (Fri, 27 Mar 2009)
New Revision: 971
Modified:
branches/2.1.x/java/org/apache/jasper/compiler/Compiler.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
- Port patch.
Modified: branches/2.1.x/java/org/apache/jasper/compiler/Compiler.java
===================================================================
--- branches/2.1.x/java/org/apache/jasper/compiler/Compiler.java 2009-03-27 12:33:33 UTC (rev 970)
+++ branches/2.1.x/java/org/apache/jasper/compiler/Compiler.java 2009-03-27 13:54:49 UTC (rev 971)
@@ -333,6 +333,14 @@
String[] smap = generateJava();
if (compileClass) {
generateClass(smap);
+ // Set JspServletWrapper.servletClassLastModifiedTime after successful compile
+ String targetFileName = ctxt.getClassFileName();
+ if (targetFileName != null) {
+ File targetFile = new File(targetFileName);
+ if (targetFile.exists() && jsw != null) {
+ jsw.setServletClassLastModifiedTime(targetFile.lastModified());
+ }
+ }
}
} finally {
if (tfp != null) {
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-03-27 12:33:33 UTC (rev 970)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-03-27 13:54:49 UTC (rev 971)
@@ -43,6 +43,9 @@
<fix>
EL resolver improvements when using a security manager. (markt)
</fix>
+ <fix>
+ <bug>41606</bug>: Fix jspInit called twice. (markt)
+ </fix>
</changelog>
</subsection>
</section>
15 years, 9 months
JBossWeb SVN: r970 - in trunk: java/javax/el and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-27 08:33:33 -0400 (Fri, 27 Mar 2009)
New Revision: 970
Modified:
trunk/ROADMAP.txt
trunk/java/javax/el/ResourceBundleELResolver.java
trunk/java/org/apache/catalina/realm/LocalStrings.properties
trunk/java/org/apache/catalina/realm/MemoryRealm.java
trunk/java/org/apache/jasper/compiler/Compiler.java
trunk/webapps/docs/changelog.xml
Log:
- Pour 3 minor patches.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/ROADMAP.txt 2009-03-27 12:33:33 UTC (rev 970)
@@ -2,11 +2,12 @@
Main development:
- Setup standalone TCK environment for testing compliance with the new features
-- Servlet 3.0 async API over IO events
+- Servlet 3.0 async API using event API
- Update digester XML parsing rules for web.xml updates
+- web.xml fragments scanning
- Annotation scanning for JBoss Web standalone (likely disabled by default using conf/web.xml)
- Multipart support (and remove fileupload)
-- Other Servlet 3.0 changes (web.xml fragments, security, etc)
+- Other Servlet 3.0 changes (security, etc)
- JSP 2.2 changes
- EL 1.1 changes
- Coordinate with AS 6 to implement new web.xml parsing (out of tree)
Modified: trunk/java/javax/el/ResourceBundleELResolver.java
===================================================================
--- trunk/java/javax/el/ResourceBundleELResolver.java 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/java/javax/el/ResourceBundleELResolver.java 2009-03-27 12:33:33 UTC (rev 970)
@@ -38,12 +38,12 @@
}
if (base instanceof ResourceBundle) {
- context.setPropertyResolved(true);
-
if (property != null) {
try {
- return ((ResourceBundle) base).getObject(property
+ Object result = ((ResourceBundle) base).getObject(property
.toString());
+ context.setPropertyResolved(true);
+ return result;
} catch (MissingResourceException mre) {
return "???" + property.toString() + "???";
}
Modified: trunk/java/org/apache/catalina/realm/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/realm/LocalStrings.properties 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/java/org/apache/catalina/realm/LocalStrings.properties 2009-03-27 12:33:33 UTC (rev 970)
@@ -49,6 +49,7 @@
memoryRealm.loadExist=Memory database file {0} cannot be read
memoryRealm.loadPath=Loading users from memory database file {0}
memoryRealm.readXml=Exception while reading memory database file
+memoryRealm.xmlFeatureEncoding=Exception configuring digester to permit java encoding names in XML files. Only IANA encoding names will be supported.
realmBase.algorithm=Invalid message digest algorithm {0} specified
realmBase.alreadyStarted=This Realm has already been started
realmBase.digest=Error digesting user credentials
Modified: trunk/java/org/apache/catalina/realm/MemoryRealm.java
===================================================================
--- trunk/java/org/apache/catalina/realm/MemoryRealm.java 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/java/org/apache/catalina/realm/MemoryRealm.java 2009-03-27 12:33:33 UTC (rev 970)
@@ -215,6 +215,13 @@
if (digester == null) {
digester = new Digester();
digester.setValidating(false);
+ try {
+ digester.setFeature(
+ "http://apache.org/xml/features/allow-java-encodings",
+ true);
+ } catch (Exception e) {
+ log.warn(sm.getString("memoryRealm.xmlFeatureEncoding"), e);
+ }
digester.addRuleSet(new MemoryRuleSet());
}
return (digester);
Modified: trunk/java/org/apache/jasper/compiler/Compiler.java
===================================================================
--- trunk/java/org/apache/jasper/compiler/Compiler.java 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/java/org/apache/jasper/compiler/Compiler.java 2009-03-27 12:33:33 UTC (rev 970)
@@ -333,6 +333,14 @@
String[] smap = generateJava();
if (compileClass) {
generateClass(smap);
+ // Set JspServletWrapper.servletClassLastModifiedTime after successful compile
+ String targetFileName = ctxt.getClassFileName();
+ if (targetFileName != null) {
+ File targetFile = new File(targetFileName);
+ if (targetFile.exists() && jsw != null) {
+ jsw.setServletClassLastModifiedTime(targetFile.lastModified());
+ }
+ }
}
} finally {
if (tfp != null) {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-23 10:50:08 UTC (rev 969)
+++ trunk/webapps/docs/changelog.xml 2009-03-27 12:33:33 UTC (rev 970)
@@ -41,6 +41,9 @@
<fix>
<bug>46866</bug>: Use nanoTime rather that a weaker init for the Random fallback. (remm)
</fix>
+ <fix>
+ <bug>45332</bug>: Encoding fix for tomcat-users file. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -53,6 +56,13 @@
</update>
</changelog>
</subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <bug>46915</bug>: JSTL issues resolving resource bundle keys. (markt)
+ </fix>
+ </changelog>
+ </subsection>
</section>
<section name="JBoss Web 2.1.3.CR1 (remm)">
@@ -79,6 +89,9 @@
<fix>
EL resolver improvements when using a security manager. (markt)
</fix>
+ <fix>
+ <bug>41606</bug>: Fix jspInit called twice. (markt)
+ </fix>
</changelog>
</subsection>
</section>
15 years, 9 months
JBossWeb SVN: r969 - in branches/2.1.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-23 06:50:08 -0400 (Mon, 23 Mar 2009)
New Revision: 969
Modified:
branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
- 46875: fix possible ISE on session access.
- Also use the regular close so that it goes in a container thread later, directly calling webapp code is evil.
Modified: branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java
===================================================================
--- branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-23 10:48:50 UTC (rev 968)
+++ branches/2.1.x/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-23 10:50:08 UTC (rev 969)
@@ -35,13 +35,11 @@
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.HttpEventImpl;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.jboss.servlet.http.HttpEvent;
-import org.jboss.servlet.http.HttpEventServlet;
/**
@@ -201,14 +199,15 @@
// serializable or required.
HttpSession session = request.getSession(false);
if (session != null) {
- session.removeAttribute(cometRequestsAttribute);
+ try {
+ session.removeAttribute(cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
// Close the comet connection
try {
- HttpEventImpl cometEvent = request.getEvent();
- cometEvent.setType(HttpEvent.EventType.END);
- getNext().event(request, request.getResponse(), cometEvent);
- cometEvent.close();
+ request.getEvent().close();
} catch (Exception e) {
container.getLogger().warn(
sm.getString("cometConnectionManagerValve.event"),
@@ -328,8 +327,12 @@
session.setAttribute(cometRequestsAttribute,
newConnectionInfos);
} else {
- session.removeAttribute(
- cometRequestsAttribute);
+ try {
+ session.removeAttribute(
+ cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
}
}
@@ -353,10 +356,7 @@
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
- HttpEventImpl event = req.getEvent();
- event.setType(HttpEvent.EventType.END);
- ((HttpEventServlet) req.getWrapper().getServlet()).event(event);
- event.close();
+ req.getEvent().close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-03-23 10:48:50 UTC (rev 968)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-03-23 10:50:08 UTC (rev 969)
@@ -26,6 +26,9 @@
<fix>
NPE in various realms. (markt)
</fix>
+ <fix>
+ <bug>46875</bug>: ISE on session access in Comet valve. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 9 months
JBossWeb SVN: r968 - in trunk: java/org/apache/jasper/el and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-23 06:48:50 -0400 (Mon, 23 Mar 2009)
New Revision: 968
Modified:
trunk/PATCHES.txt
trunk/java/org/apache/jasper/el/ELContextImpl.java
trunk/java/org/apache/jasper/el/ELResolverImpl.java
Log:
- Dependency fix.
Modified: trunk/PATCHES.txt
===================================================================
--- trunk/PATCHES.txt 2009-03-22 01:32:22 UTC (rev 967)
+++ trunk/PATCHES.txt 2009-03-23 10:48:50 UTC (rev 968)
@@ -56,3 +56,5 @@
752651, 752936
XmlBase configuration
+757223
+AJP hack to pass remote port (the protocol does not do it, well, too bad)
Modified: trunk/java/org/apache/jasper/el/ELContextImpl.java
===================================================================
--- trunk/java/org/apache/jasper/el/ELContextImpl.java 2009-03-22 01:32:22 UTC (rev 967)
+++ trunk/java/org/apache/jasper/el/ELContextImpl.java 2009-03-23 10:48:50 UTC (rev 968)
@@ -26,7 +26,7 @@
import javax.el.ValueExpression;
import javax.el.VariableMapper;
-import org.apache.catalina.Globals;
+import org.apache.jasper.Constants;
/**
* Implementation of ELContext
@@ -69,7 +69,7 @@
public ELContextImpl() {
this(ELResolverImpl.getDefaultResolver());
- if (Globals.IS_SECURITY_ENABLED) {
+ if (Constants.IS_SECURITY_ENABLED) {
functionMapper = new FunctionMapper() {
public Method resolveFunction(String prefix, String localName) {
return null;
Modified: trunk/java/org/apache/jasper/el/ELResolverImpl.java
===================================================================
--- trunk/java/org/apache/jasper/el/ELResolverImpl.java 2009-03-22 01:32:22 UTC (rev 967)
+++ trunk/java/org/apache/jasper/el/ELResolverImpl.java 2009-03-23 10:48:50 UTC (rev 968)
@@ -32,8 +32,9 @@
import javax.el.ResourceBundleELResolver;
import javax.servlet.jsp.el.VariableResolver;
-import org.apache.catalina.Globals;
+import org.apache.jasper.Constants;
+
public final class ELResolverImpl extends ELResolver {
/** @deprecated - Use getDefaultResolver(). Needs to be made private */
public final static ELResolver DefaultResolver = new CompositeELResolver();
@@ -146,7 +147,7 @@
}
public static ELResolver getDefaultResolver() {
- if (Globals.IS_SECURITY_ENABLED) {
+ if (Constants.IS_SECURITY_ENABLED) {
ELResolver defaultResolver = new CompositeELResolver();
((CompositeELResolver) defaultResolver).add(new MapELResolver());
((CompositeELResolver) defaultResolver).add(new ResourceBundleELResolver());
15 years, 9 months
JBossWeb SVN: r967 - in trunk: java/org/apache/catalina/core and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-21 21:32:22 -0400 (Sat, 21 Mar 2009)
New Revision: 967
Modified:
trunk/java/org/apache/catalina/connector/HttpEventImpl.java
trunk/java/org/apache/catalina/connector/InputBuffer.java
trunk/java/org/apache/catalina/connector/OutputBuffer.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
trunk/java/org/apache/catalina/core/BaseAnnotationScanner.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java
trunk/webapps/docs/aio.xml
Log:
- More comet -> event.
- Implement some more trivial Servlet 3.0 stuff.
- Use the new async dispatcher type for all event filtering, which is a lot better than plain request.
Modified: trunk/java/org/apache/catalina/connector/HttpEventImpl.java
===================================================================
--- trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -114,7 +114,7 @@
}
public String toString() {
- StringBuffer buf = new StringBuffer("CometEventImpl[");
+ StringBuffer buf = new StringBuffer("HttpEventImpl[");
buf.append(super.toString());
buf.append("] Event:");
buf.append(getType());
Modified: trunk/java/org/apache/catalina/connector/InputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -239,7 +239,7 @@
/**
- * Clear cached encoders (to save memory for Comet requests).
+ * Clear cached encoders (to save memory for event requests).
*/
public void clearEncoders() {
encoders.clear();
Modified: trunk/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/OutputBuffer.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/connector/OutputBuffer.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -260,7 +260,7 @@
/**
- * Clear cached encoders (to save memory for Comet requests).
+ * Clear cached encoders (to save memory for event requests).
*/
public void clearEncoders() {
encoders.clear();
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -399,6 +399,7 @@
dispatcherType = null;
requestDispatcherPath = null;
+ asyncMode = false;
eventMode = false;
if (event != null) {
event.clear();
@@ -2757,10 +2758,8 @@
return null;
}
- @Override
public boolean isAsyncStarted() {
- // TODO Auto-generated method stub
- return false;
+ return asyncMode;
}
@Override
@@ -2769,10 +2768,8 @@
return false;
}
- @Override
public void setAsyncTimeout(long timeout) {
- // TODO Auto-generated method stub
-
+ setTimeout((timeout > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) timeout);
}
@Override
@@ -2788,16 +2785,26 @@
return null;
}
- @Override
public DispatcherType getDispatcherType() {
- // TODO Auto-generated method stub
- return null;
+ if (dispatcherType == null) {
+ return DispatcherType.REQUEST;
+ } else if (dispatcherType == ApplicationFilterFactory.REQUEST_INTEGER) {
+ return DispatcherType.REQUEST;
+ } else if (dispatcherType == ApplicationFilterFactory.ASYNC_INTEGER) {
+ return DispatcherType.ASYNC;
+ } else if (dispatcherType == ApplicationFilterFactory.ERROR_INTEGER) {
+ return DispatcherType.ERROR;
+ } else if (dispatcherType == ApplicationFilterFactory.FORWARD_INTEGER) {
+ return DispatcherType.FORWARD;
+ } else if (dispatcherType == ApplicationFilterFactory.INCLUDE_INTEGER) {
+ return DispatcherType.INCLUDE;
+ }
+ // Never happens
+ throw new IllegalStateException();
}
- @Override
public ServletResponse getServletResponse() {
- // TODO Auto-generated method stub
- return null;
+ return response;
}
}
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -1047,7 +1047,7 @@
sm.getString("requestFacade.nullRequest"));
}
- return request.getServletResponse();
+ return request.getResponse().getResponse();
}
}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -52,6 +52,8 @@
public static final Integer INCLUDE_INTEGER = new Integer(INCLUDE);
public static final int REQUEST = 8;
public static final Integer REQUEST_INTEGER = new Integer(REQUEST);
+ public static final int ASYNC = 16;
+ public static final Integer ASYNC_INTEGER = new Integer(ASYNC);
public static final String DISPATCHER_TYPE_ATTR =
Globals.DISPATCHER_TYPE_ATTR;
@@ -346,6 +348,7 @@
* matches the dispatcher types specified in the FilterMap
*/
private boolean matchDispatcher(FilterMap filterMap, int dispatcher) {
+ // FIXME: add async
switch (dispatcher) {
case FORWARD : {
if (filterMap.getDispatcherMapping() == FilterMap.FORWARD ||
@@ -355,7 +358,15 @@
filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE) {
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
return true;
}
break;
@@ -368,7 +379,15 @@
filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE) {
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
return true;
}
break;
@@ -381,7 +400,15 @@
filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE) {
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE) {
return true;
}
break;
@@ -394,11 +421,40 @@
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE) {
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE) {
return true;
}
break;
}
+ case ASYNC : {
+ if (filterMap.getDispatcherMapping() == FilterMap.ASYNC ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_FORWARD_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_INCLUDE_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_ERROR_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.ASYNC_REQUEST_FORWARD_INCLUDE) {
+ return true;
+ }
+ break;
+ }
}
return false;
}
Modified: trunk/java/org/apache/catalina/core/BaseAnnotationScanner.java
===================================================================
--- trunk/java/org/apache/catalina/core/BaseAnnotationScanner.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/core/BaseAnnotationScanner.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -1,18 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -392,7 +392,7 @@
}
request.setAttribute
(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
- ApplicationFilterFactory.REQUEST_INTEGER);
+ ApplicationFilterFactory.ASYNC_INTEGER);
request.setAttribute
(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
requestPathMB);
Modified: trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java 2009-03-22 01:32:22 UTC (rev 967)
@@ -191,6 +191,7 @@
public void lifecycleEvent(LifecycleEvent event) {
if (event.getType() == Lifecycle.BEFORE_STOP_EVENT) {
+ // FIXME: in that case, it could be useful to wait until end events are processed. Mmmm.
// The container is getting stopped, close all current connections
Iterator<Request> iterator = cometRequests.iterator();
while (iterator.hasNext()) {
Modified: trunk/webapps/docs/aio.xml
===================================================================
--- trunk/webapps/docs/aio.xml 2009-03-20 17:26:19 UTC (rev 966)
+++ trunk/webapps/docs/aio.xml 2009-03-22 01:32:22 UTC (rev 967)
@@ -210,7 +210,27 @@
the HttpEventFiler interface.
</p>
- </subsection>
+ <subsection name="Servlet 3.0 Async">
+
+ <p>
+ Servlet 3.0 introduces async support to regular Servlets, roughly equivalent to this event API
+ excluding the events generated from actual IO (READ and WRITE). Internally, async support is
+ implemented using the event functionality, and presented to the user through the Servlet API.
+ </p>
+
+ <!--subsection name="Tracking session and webapp lifecycle">
+
+ <p>
+ Since the duration of the request processing is much longer when using event based connections,
+ sessions might expire and webapps might be reloaded. The EventOrAsyncConnectionManagerValve valve
+ can be used to generate END events when this occurs. It is configured using a regular valve element,
+ using the <code>org.apache.catalina.valves.EventOrAsyncConnectionManagerValve</code> className, and
+ it does not have any configuration parameters. As events are asynchronous while webapp and session
+ lifecycle are not, no guarantee is given that an END event will be sent when redeploying a webapp, or
+ that the session will be still valid during processing of the END event.
+ </p>
+
+ </subsection-->
<subsection name="Example code">
15 years, 9 months
JBossWeb SVN: r966 - in trunk: java/org/apache/catalina/connector and 7 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-20 13:26:19 -0400 (Fri, 20 Mar 2009)
New Revision: 966
Added:
trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java
Modified:
trunk/java/org/apache/catalina/Valve.java
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/catalina/connector/HttpEventImpl.java
trunk/java/org/apache/catalina/connector/InputBuffer.java
trunk/java/org/apache/catalina/connector/OutputBuffer.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
trunk/java/org/apache/coyote/ActionCode.java
trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/java/org/apache/coyote/ajp/AjpProcessor.java
trunk/java/org/apache/coyote/ajp/AjpProtocol.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/java/org/apache/coyote/http11/Http11Processor.java
trunk/java/org/apache/coyote/http11/Http11Protocol.java
trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
trunk/webapps/docs/changelog.xml
Log:
- Rename comet to event (ok, I guess I am bored ;) ).
- Handle the keepalive scenario for the java.io endpoint.
Modified: trunk/java/org/apache/catalina/Valve.java
===================================================================
--- trunk/java/org/apache/catalina/Valve.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/Valve.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -133,7 +133,7 @@
/**
- * Process a Comet event.
+ * Process an event.
*
* @param request The servlet request to be processed
* @param response The servlet response to be created
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -148,12 +148,12 @@
// The response IO has been closed asynchronously, so call end
// in most cases
request.getEvent().setType(HttpEvent.EventType.END);
- request.setComet(false);
+ request.setEventMode(false);
close = true;
}
switch (status) {
case OPEN_READ:
- if (!request.isComet()) {
+ if (!request.isEventMode()) {
// The event has been closed asynchronously, so call end instead of
// read to cleanup the pipeline
request.getEvent().setType(HttpEvent.EventType.END);
@@ -184,7 +184,7 @@
}
break;
case OPEN_WRITE:
- if (!request.isComet()) {
+ if (!request.isEventMode()) {
// The event has been closed asynchronously, so call end instead of
// read to cleanup the pipeline
request.getEvent().setType(HttpEvent.EventType.END);
@@ -194,7 +194,7 @@
}
break;
case OPEN_CALLBACK:
- if (!request.isComet()) {
+ if (!request.isEventMode()) {
// The event has been closed asynchronously, so call end instead of
// read to cleanup the pipeline
// In nearly all cases, the close does a resume which will end up
@@ -215,7 +215,7 @@
close = true;
break;
case TIMEOUT:
- if (!request.isComet()) {
+ if (!request.isEventMode()) {
// The event has been closed asynchronously, so call end instead of
// read to cleanup the pipeline
request.getEvent().setType(HttpEvent.EventType.END);
@@ -272,7 +272,7 @@
request.recycle();
request.setFilterChain(null);
response.recycle();
- res.action(ActionCode.ACTION_COMET_END, null);
+ res.action(ActionCode.ACTION_EVENT_END, null);
}
}
@@ -318,7 +318,7 @@
response.addHeader("X-Powered-By", "Servlet/3.0");
}
- boolean comet = false;
+ boolean event = false;
try {
// Parse and set Catalina and configuration specific
@@ -329,20 +329,20 @@
// Calling the container
connector.getContainer().getPipeline().getFirst().invoke(request, response);
- if (request.isComet()) {
+ if (request.isEventMode()) {
if (!response.isClosed() && !response.isError()) {
- res.action(ActionCode.ACTION_COMET_BEGIN, null);
- comet = true;
+ res.action(ActionCode.ACTION_EVENT_BEGIN, null);
+ event = true;
} else {
// Clear the filter chain, as otherwise it will not be reset elsewhere
- // since this is a Comet request
+ // since this is an event driven request
request.setFilterChain(null);
}
}
}
- if (!comet) {
+ if (!event) {
response.finishResponse();
req.action(ActionCode.ACTION_POST_REQUEST , null);
}
@@ -354,7 +354,7 @@
} finally {
req.getRequestProcessor().setWorkerThreadName(null);
// Recycle the wrapper request and response
- if (!comet) {
+ if (!event) {
request.recycle();
response.recycle();
} else {
Modified: trunk/java/org/apache/catalina/connector/HttpEventImpl.java
===================================================================
--- trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -77,7 +77,7 @@
}
public void close() throws IOException {
- request.setComet(false);
+ request.setEventMode(false);
request.resume();
}
Modified: trunk/java/org/apache/catalina/connector/InputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -280,7 +280,7 @@
int available = 0;
if (state != CHAR_STATE) {
available = bb.getLength();
- if (request.isComet() && available == 0) {
+ if (request.isEventMode() && available == 0) {
try {
coyoteRequest.action(ActionCode.ACTION_AVAILABLE, null);
available = realReadBytes(null, 0, 0);
@@ -291,7 +291,7 @@
}
} else {
available = cb.getLength();
- if (request.isComet() && available == 0) {
+ if (request.isEventMode() && available == 0) {
try {
coyoteRequest.action(ActionCode.ACTION_AVAILABLE, null);
available = realReadChars(null, 0, cb.getBuffer().length);
Modified: trunk/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/OutputBuffer.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/OutputBuffer.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -359,7 +359,7 @@
protected int lastWrite() {
int res = coyoteResponse.getLastWrite();
if (res == 0) {
- coyoteResponse.action(ActionCode.ACTION_COMET_WRITE, null);
+ coyoteResponse.action(ActionCode.ACTION_EVENT_WRITE, null);
}
return res;
}
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -199,6 +199,12 @@
/**
+ * Servlet 3.0 asynchronous mode flag
+ */
+ protected boolean asyncMode = false;
+
+
+ /**
* Authentication type.
*/
protected String authType = null;
@@ -211,9 +217,9 @@
/**
- * Comet state
+ * Event mode flag
*/
- protected boolean comet = false;
+ protected boolean eventMode = false;
/**
@@ -393,7 +399,7 @@
dispatcherType = null;
requestDispatcherPath = null;
- comet = false;
+ eventMode = false;
if (event != null) {
event.clear();
event = null;
@@ -458,7 +464,7 @@
/**
- * Clear cached encoders (to save memory for Comet requests).
+ * Clear cached encoders (to save memory for event or async requests).
*/
public void clearEncoders() {
inputBuffer.clearEncoders();
@@ -2264,18 +2270,18 @@
/**
- * Return true if the current request is handling Comet traffic.
+ * Return true if the current request is using event mode.
*/
- public boolean isComet() {
- return comet;
+ public boolean isEventMode() {
+ return eventMode;
}
/**
- * Set comet state.
+ * Set event mode.
*/
- public void setComet(boolean comet) {
- this.comet = comet;
+ public void setEventMode(boolean eventMode) {
+ this.eventMode = eventMode;
}
@@ -2291,17 +2297,17 @@
* Set connection timeout.
*/
public void setTimeout(int timeout) {
- coyoteRequest.action(ActionCode.ACTION_COMET_TIMEOUT, new Integer(timeout));
+ coyoteRequest.action(ActionCode.ACTION_EVENT_TIMEOUT, timeout);
}
public void resume() {
- coyoteRequest.action(ActionCode.ACTION_COMET_RESUME, null);
+ coyoteRequest.action(ActionCode.ACTION_EVENT_RESUME, null);
}
public void suspend() {
- coyoteRequest.action(ActionCode.ACTION_COMET_SUSPEND, null);
+ coyoteRequest.action(ActionCode.ACTION_EVENT_SUSPEND, null);
}
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/connector/Response.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -289,7 +289,7 @@
/**
- * Clear cached encoders (to save memory for Comet requests).
+ * Clear cached encoders (to save memory for event or async requests).
*/
public void clearEncoders() {
outputBuffer.clearEncoders();
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -123,7 +123,7 @@
ApplicationFilterChain filterChain = null;
if (request instanceof Request) {
Request req = (Request) request;
- comet = req.isComet();
+ comet = req.isEventMode();
if (Globals.IS_SECURITY_ENABLED) {
// Security: Do not recycle
filterChain = new ApplicationFilterChain();
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -159,11 +159,11 @@
// Identify if the request should be switched to event mode now that
// the servlet has been allocated
- boolean comet = false;
+ boolean event = false;
if (servlet instanceof HttpEventServlet
&& request.getConnector().hasIoEvents()) {
- comet = true;
- request.setComet(true);
+ event = true;
+ request.setEventMode(true);
}
// Acknowledge the request
@@ -197,8 +197,8 @@
ApplicationFilterFactory.getInstance();
ApplicationFilterChain filterChain =
factory.createFilterChain(request, wrapper, servlet);
- // Reset comet flag value after creating the filter chain
- request.setComet(false);
+ // Reset event flag value after creating the filter chain
+ request.setEventMode(false);
// Call the filter chain for this request
// NOTE: This also calls the servlet's service() method
@@ -213,8 +213,8 @@
if (context.getSwallowOutput()) {
try {
SystemLogHandler.startCapture();
- if (comet) {
- request.setComet(true);
+ if (event) {
+ request.setEventMode(true);
request.getSession(true);
filterChain.doFilterEvent(request.getEvent());
} else {
@@ -228,8 +228,8 @@
}
}
} else {
- if (comet) {
- request.setComet(true);
+ if (event) {
+ request.setEventMode(true);
request.getSession(true);
filterChain.doFilterEvent(request.getEvent());
} else {
@@ -289,8 +289,8 @@
// Release the filter chain (if any) for this request
if (filterChain != null) {
- if (request.isComet()) {
- // If this is a Comet request, then the same chain will be used for the
+ if (request.isEventMode()) {
+ // If this is a event request, then the same chain will be used for the
// processing of all subsequent events.
filterChain.reuse();
} else {
@@ -338,7 +338,7 @@
/**
- * Process a Comet event. The main differences here are to not use sendError
+ * Process an event. The main differences here are to not use sendError
* (the response is committed), to avoid creating a new filter chain
* (which would work but be pointless), and a few very minor tweaks.
*
Modified: trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -19,29 +19,8 @@
package org.apache.catalina.valves;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-import org.apache.catalina.Context;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.LifecycleEvent;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.catalina.util.LifecycleSupport;
-import org.apache.catalina.util.StringManager;
-import org.jboss.servlet.http.HttpEvent;
-
-
/**
* <p>Implementation of a Valve that tracks Comet connections, and closes them
* when the associated session expires or the webapp is reloaded.</p>
@@ -50,319 +29,9 @@
*
* @author Remy Maucherat
* @version $Revision$ $Date$
+ * @deprecated Replaced by EventOrAsyncConnectionManagerValve
*/
public class CometConnectionManagerValve
- extends ValveBase
- implements Lifecycle, HttpSessionListener, LifecycleListener {
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * The descriptive information related to this implementation.
- */
- protected static final String info =
- "org.apache.catalina.valves.CometConnectionManagerValve/1.0";
-
-
- /**
- * The string manager for this package.
- */
- protected StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- /**
- * The lifecycle event support for this component.
- */
- protected LifecycleSupport lifecycle = new LifecycleSupport(this);
-
-
- /**
- * Has this component been started yet?
- */
- protected boolean started = false;
-
-
- /**
- * List of current Coment connections.
- */
- protected List<Request> cometRequests =
- Collections.synchronizedList(new ArrayList<Request>());
-
-
- /**
- * Name of session attribute used to store list of comet connections.
- */
- protected String cometRequestsAttribute =
- "org.apache.tomcat.comet.connectionList";
-
-
- // ------------------------------------------------------------- Properties
-
-
- // ------------------------------------------------------ Lifecycle Methods
-
-
- /**
- * Add a lifecycle event listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
-
- lifecycle.addLifecycleListener(listener);
-
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
-
- return lifecycle.findLifecycleListeners();
-
- }
-
-
- /**
- * Remove a lifecycle event listener from this component.
- *
- * @param listener The listener to add
- */
- public void removeLifecycleListener(LifecycleListener listener) {
-
- lifecycle.removeLifecycleListener(listener);
-
- }
-
-
- /**
- * Prepare for the beginning of active use of the public methods of this
- * component. This method should be called after <code>configure()</code>,
- * and before any of the public methods of the component are utilized.
- *
- * @exception LifecycleException if this component detects a fatal error
- * that prevents this component from being used
- */
- public void start() throws LifecycleException {
-
- // Validate and update our current component state
- if (started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.alreadyStarted"));
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- started = true;
-
- if (container instanceof Context) {
- ((Lifecycle) container).addLifecycleListener(this);
- }
-
- }
-
-
- /**
- * Gracefully terminate the active use of the public methods of this
- * component. This method should be the last one called on a given
- * instance of this component.
- *
- * @exception LifecycleException if this component detects a fatal error
- * that needs to be reported
- */
- public void stop() throws LifecycleException {
-
- // Validate and update our current component state
- if (!started)
- throw new LifecycleException
- (sm.getString("semaphoreValve.notStarted"));
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- started = false;
-
- if (container instanceof Context) {
- ((Lifecycle) container).removeLifecycleListener(this);
- }
-
- }
-
-
- public void lifecycleEvent(LifecycleEvent event) {
- if (event.getType() == Lifecycle.BEFORE_STOP_EVENT) {
- // The container is getting stopped, close all current connections
- Iterator<Request> iterator = cometRequests.iterator();
- while (iterator.hasNext()) {
- Request request = iterator.next();
- // Remove the session tracking attribute as it isn't
- // serializable or required.
- HttpSession session = request.getSession(false);
- if (session != null) {
- try {
- session.removeAttribute(cometRequestsAttribute);
- } catch (IllegalStateException e) {
- // Ignore
- }
- }
- // Close the comet connection
- try {
- request.getEvent().close();
- } catch (Exception e) {
- container.getLogger().warn(
- sm.getString("cometConnectionManagerValve.event"),
- e);
- }
- }
- cometRequests.clear();
- }
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Return descriptive information about this Valve implementation.
- */
- public String getInfo() {
- return (info);
- }
-
-
- /**
- * Register requests for tracking, whenever needed.
- *
- * @param request The servlet request to be processed
- * @param response The servlet response to be created
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet error occurs
- */
- public void invoke(Request request, Response response)
- throws IOException, ServletException {
- // Perform the request
- getNext().invoke(request, response);
-
- if (request.isComet() && !response.isClosed()) {
- // Start tracking this connection, since this is a
- // begin event, and Comet mode is on
- HttpSession session = request.getSession(true);
-
- // Track the conection for webapp reload
- cometRequests.add(request);
-
- // Track the connection for session expiration
- synchronized (session) {
- Request[] requests = (Request[])
- session.getAttribute(cometRequestsAttribute);
- if (requests == null) {
- requests = new Request[1];
- requests[0] = request;
- session.setAttribute(cometRequestsAttribute,
- requests);
- } else {
- Request[] newRequests =
- new Request[requests.length + 1];
- for (int i = 0; i < requests.length; i++) {
- newRequests[i] = requests[i];
- }
- newRequests[requests.length] = request;
- session.setAttribute(cometRequestsAttribute, newRequests);
- }
- }
- }
-
- }
-
-
- /**
- * Use events to update the connection state.
- *
- * @param request The servlet request to be processed
- * @param response The servlet response to be created
- *
- * @exception IOException if an input/output error occurs
- * @exception ServletException if a servlet error occurs
- */
- public void event(Request request, Response response, HttpEvent event)
- throws IOException, ServletException {
-
- // Perform the request
- boolean ok = false;
- try {
- getNext().event(request, response, event);
- ok = true;
- } finally {
- if (!ok || response.isClosed()
- || (event.getType() == HttpEvent.EventType.END)
- || (event.getType() == HttpEvent.EventType.ERROR)) {
-
- // Remove the connection from webapp reload tracking
- cometRequests.remove(request);
-
- // Remove connection from session expiration tracking
- // Note: can't get the session if it has been invalidated but
- // OK since session listener will have done clean-up
- HttpSession session = request.getSession(false);
- if (session != null) {
- synchronized (session) {
- Request[] reqs = (Request[])
- session.getAttribute(cometRequestsAttribute);
- if (reqs != null) {
- boolean found = false;
- for (int i = 0; !found && (i < reqs.length); i++) {
- found = (reqs[i] == request);
- }
- if (found) {
- if (reqs.length > 1) {
- Request[] newConnectionInfos =
- new Request[reqs.length - 1];
- int pos = 0;
- for (int i = 0; i < reqs.length; i++) {
- if (reqs[i] != request) {
- newConnectionInfos[pos++] = reqs[i];
- }
- }
- session.setAttribute(cometRequestsAttribute,
- newConnectionInfos);
- } else {
- try {
- session.removeAttribute(
- cometRequestsAttribute);
- } catch (IllegalStateException e) {
- // Ignore
- }
- }
- }
- }
- }
- }
- }
- }
-
- }
-
-
- public void sessionCreated(HttpSessionEvent se) {
- }
-
-
- public void sessionDestroyed(HttpSessionEvent se) {
- // Close all Comet connections associated with this session
- Request[] reqs = (Request[])
- se.getSession().getAttribute(cometRequestsAttribute);
- if (reqs != null) {
- for (int i = 0; i < reqs.length; i++) {
- Request req = reqs[i];
- try {
- req.getEvent().close();
- } catch (Exception e) {
- req.getWrapper().getParent().getLogger().warn(sm.getString(
- "cometConnectionManagerValve.listenerEvent"), e);
- }
- }
- }
- }
-
+ extends EventOrAsyncConnectionManagerValve {
}
Added: trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java (rev 0)
+++ trunk/java/org/apache/catalina/valves/EventOrAsyncConnectionManagerValve.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -0,0 +1,368 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.valves;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.util.LifecycleSupport;
+import org.apache.catalina.util.StringManager;
+import org.jboss.servlet.http.HttpEvent;
+
+
+/**
+ * <p>Implementation of a Valve that tracks Comet connections, and closes them
+ * when the associated session expires or the webapp is reloaded.</p>
+ *
+ * <p>This Valve should be attached to a Context.</p>
+ *
+ * @author Remy Maucherat
+ * @version $Revision: 965 $ $Date: 2009-03-19 19:30:09 +0100 (Thu, 19 Mar 2009) $
+ */
+
+public class EventOrAsyncConnectionManagerValve
+ extends ValveBase
+ implements Lifecycle, HttpSessionListener, LifecycleListener {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The descriptive information related to this implementation.
+ */
+ protected static final String info =
+ "org.apache.catalina.valves.CometConnectionManagerValve/1.0";
+
+
+ /**
+ * The string manager for this package.
+ */
+ protected StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
+ /**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
+ * Has this component been started yet?
+ */
+ protected boolean started = false;
+
+
+ /**
+ * List of current Coment connections.
+ */
+ protected List<Request> cometRequests =
+ Collections.synchronizedList(new ArrayList<Request>());
+
+
+ /**
+ * Name of session attribute used to store list of comet connections.
+ */
+ protected String cometRequestsAttribute =
+ "org.apache.tomcat.comet.connectionList";
+
+
+ // ------------------------------------------------------------- Properties
+
+
+ // ------------------------------------------------------ Lifecycle Methods
+
+
+ /**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Get the lifecycle listeners associated with this lifecycle. If this
+ * Lifecycle has no listeners registered, a zero-length array is returned.
+ */
+ public LifecycleListener[] findLifecycleListeners() {
+
+ return lifecycle.findLifecycleListeners();
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Prepare for the beginning of active use of the public methods of this
+ * component. This method should be called after <code>configure()</code>,
+ * and before any of the public methods of the component are utilized.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that prevents this component from being used
+ */
+ public void start() throws LifecycleException {
+
+ // Validate and update our current component state
+ if (started)
+ throw new LifecycleException
+ (sm.getString("semaphoreValve.alreadyStarted"));
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
+ started = true;
+
+ if (container instanceof Context) {
+ ((Lifecycle) container).addLifecycleListener(this);
+ }
+
+ }
+
+
+ /**
+ * Gracefully terminate the active use of the public methods of this
+ * component. This method should be the last one called on a given
+ * instance of this component.
+ *
+ * @exception LifecycleException if this component detects a fatal error
+ * that needs to be reported
+ */
+ public void stop() throws LifecycleException {
+
+ // Validate and update our current component state
+ if (!started)
+ throw new LifecycleException
+ (sm.getString("semaphoreValve.notStarted"));
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
+ started = false;
+
+ if (container instanceof Context) {
+ ((Lifecycle) container).removeLifecycleListener(this);
+ }
+
+ }
+
+
+ public void lifecycleEvent(LifecycleEvent event) {
+ if (event.getType() == Lifecycle.BEFORE_STOP_EVENT) {
+ // The container is getting stopped, close all current connections
+ Iterator<Request> iterator = cometRequests.iterator();
+ while (iterator.hasNext()) {
+ Request request = iterator.next();
+ // Remove the session tracking attribute as it isn't
+ // serializable or required.
+ HttpSession session = request.getSession(false);
+ if (session != null) {
+ try {
+ session.removeAttribute(cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
+ }
+ // Close the comet connection
+ try {
+ request.getEvent().close();
+ } catch (Exception e) {
+ container.getLogger().warn(
+ sm.getString("cometConnectionManagerValve.event"),
+ e);
+ }
+ }
+ cometRequests.clear();
+ }
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Return descriptive information about this Valve implementation.
+ */
+ public String getInfo() {
+ return (info);
+ }
+
+
+ /**
+ * Register requests for tracking, whenever needed.
+ *
+ * @param request The servlet request to be processed
+ * @param response The servlet response to be created
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception ServletException if a servlet error occurs
+ */
+ public void invoke(Request request, Response response)
+ throws IOException, ServletException {
+ // Perform the request
+ getNext().invoke(request, response);
+
+ if (request.isEventMode() && !response.isClosed()) {
+ // Start tracking this connection, since this is a
+ // begin event, and Comet mode is on
+ HttpSession session = request.getSession(true);
+
+ // Track the conection for webapp reload
+ cometRequests.add(request);
+
+ // Track the connection for session expiration
+ synchronized (session) {
+ Request[] requests = (Request[])
+ session.getAttribute(cometRequestsAttribute);
+ if (requests == null) {
+ requests = new Request[1];
+ requests[0] = request;
+ session.setAttribute(cometRequestsAttribute,
+ requests);
+ } else {
+ Request[] newRequests =
+ new Request[requests.length + 1];
+ for (int i = 0; i < requests.length; i++) {
+ newRequests[i] = requests[i];
+ }
+ newRequests[requests.length] = request;
+ session.setAttribute(cometRequestsAttribute, newRequests);
+ }
+ }
+ }
+
+ }
+
+
+ /**
+ * Use events to update the connection state.
+ *
+ * @param request The servlet request to be processed
+ * @param response The servlet response to be created
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception ServletException if a servlet error occurs
+ */
+ public void event(Request request, Response response, HttpEvent event)
+ throws IOException, ServletException {
+
+ // Perform the request
+ boolean ok = false;
+ try {
+ getNext().event(request, response, event);
+ ok = true;
+ } finally {
+ if (!ok || response.isClosed()
+ || (event.getType() == HttpEvent.EventType.END)
+ || (event.getType() == HttpEvent.EventType.ERROR)) {
+
+ // Remove the connection from webapp reload tracking
+ cometRequests.remove(request);
+
+ // Remove connection from session expiration tracking
+ // Note: can't get the session if it has been invalidated but
+ // OK since session listener will have done clean-up
+ HttpSession session = request.getSession(false);
+ if (session != null) {
+ synchronized (session) {
+ Request[] reqs = (Request[])
+ session.getAttribute(cometRequestsAttribute);
+ if (reqs != null) {
+ boolean found = false;
+ for (int i = 0; !found && (i < reqs.length); i++) {
+ found = (reqs[i] == request);
+ }
+ if (found) {
+ if (reqs.length > 1) {
+ Request[] newConnectionInfos =
+ new Request[reqs.length - 1];
+ int pos = 0;
+ for (int i = 0; i < reqs.length; i++) {
+ if (reqs[i] != request) {
+ newConnectionInfos[pos++] = reqs[i];
+ }
+ }
+ session.setAttribute(cometRequestsAttribute,
+ newConnectionInfos);
+ } else {
+ try {
+ session.removeAttribute(
+ cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+ public void sessionCreated(HttpSessionEvent se) {
+ }
+
+
+ public void sessionDestroyed(HttpSessionEvent se) {
+ // Close all Comet connections associated with this session
+ Request[] reqs = (Request[])
+ se.getSession().getAttribute(cometRequestsAttribute);
+ if (reqs != null) {
+ for (int i = 0; i < reqs.length; i++) {
+ Request req = reqs[i];
+ try {
+ req.getEvent().close();
+ } catch (Exception e) {
+ req.getWrapper().getParent().getLogger().warn(sm.getString(
+ "cometConnectionManagerValve.listenerEvent"), e);
+ }
+ }
+ }
+ }
+
+}
Modified: trunk/java/org/apache/coyote/ActionCode.java
===================================================================
--- trunk/java/org/apache/coyote/ActionCode.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/ActionCode.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -135,15 +135,15 @@
/**
- * Callback for begin Comet processing
+ * Callback for begin event processing
*/
- public static final ActionCode ACTION_COMET_BEGIN = new ActionCode(21);
+ public static final ActionCode ACTION_EVENT_BEGIN = new ActionCode(21);
/**
- * Callback for begin Comet processing
+ * Callback for begin event processing
*/
- public static final ActionCode ACTION_COMET_END = new ActionCode(22);
+ public static final ActionCode ACTION_EVENT_END = new ActionCode(22);
/**
@@ -152,24 +152,24 @@
public static final ActionCode ACTION_AVAILABLE = new ActionCode(23);
/**
- * Set a Comet connection timeout
+ * Set a event connection timeout
*/
- public static final ActionCode ACTION_COMET_TIMEOUT = new ActionCode(24);
+ public static final ActionCode ACTION_EVENT_TIMEOUT = new ActionCode(24);
/**
- * Ask for a callback
+ * Ask for a callback event
*/
- public static final ActionCode ACTION_COMET_RESUME = new ActionCode(25);
+ public static final ActionCode ACTION_EVENT_RESUME = new ActionCode(25);
/**
* Put this request to sleep (no read notifications)
*/
- public static final ActionCode ACTION_COMET_SUSPEND = new ActionCode(26);
+ public static final ActionCode ACTION_EVENT_SUSPEND = new ActionCode(26);
/**
* Ask for a write callback
*/
- public static final ActionCode ACTION_COMET_WRITE = new ActionCode(27);
+ public static final ActionCode ACTION_EVENT_WRITE = new ActionCode(27);
// ----------------------------------------------------------- Constructors
int code;
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -271,17 +271,17 @@
/**
- * Comet used.
+ * Event used.
*/
- protected boolean comet = false;
+ protected boolean event = false;
/**
- * Comet processing.
+ * Event processing.
*/
- protected boolean cometProcessing = true;
- public void startProcessing() { cometProcessing = true; }
- public void endProcessing() { cometProcessing = false; }
+ protected boolean eventProcessing = true;
+ public void startProcessing() { eventProcessing = true; }
+ public void endProcessing() { eventProcessing = false; }
// ----------------------------------------------------- Static Initializer
@@ -396,7 +396,7 @@
if (error) {
recycle();
return SocketState.CLOSED;
- } else if (!comet) {
+ } else if (!event) {
finish();
recycle();
return SocketState.OPEN;
@@ -428,7 +428,7 @@
boolean openSocket = true;
boolean keptAlive = false;
- while (!error && !comet) {
+ while (!error && !event) {
// Parsing the request header
try {
@@ -498,7 +498,7 @@
}
// Finish the response if not done yet
- if (!comet && !finished) {
+ if (!event && !finished) {
try {
finish();
} catch (Throwable t) {
@@ -513,7 +513,7 @@
}
request.updateCounters();
- if (!comet) {
+ if (!event) {
recycle();
}
@@ -523,12 +523,12 @@
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (comet) {
+ if (event) {
if (error) {
recycle();
return SocketState.CLOSED;
} else {
- cometProcessing = false;
+ eventProcessing = false;
return SocketState.LONG;
}
} else {
@@ -661,20 +661,20 @@
empty = false;
replay = true;
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
- comet = true;
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
- comet = false;
- } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_BEGIN) {
+ event = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_END) {
+ event = false;
+ } else if (actionCode == ActionCode.ACTION_EVENT_SUSPEND) {
// No action needed
- } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_RESUME) {
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
- if (!cometProcessing && !resumeNotification) {
- endpoint.getCometPoller().add(socket, timeout, false, false, true, true);
+ if (!eventProcessing && !resumeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, false, false, true, true);
}
resumeNotification = true;
- } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
timeout = ((Integer) param).intValue();
}
@@ -1273,7 +1273,7 @@
finished = false;
timeout = -1;
resumeNotification = false;
- cometProcessing = true;
+ eventProcessing = true;
request.recycle();
response.recycle();
certificates.recycle();
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -430,7 +430,7 @@
}
} else {
if (proto.endpoint.isRunning()) {
- proto.endpoint.getCometPoller().add(socket, result.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
false, false, result.getResumeNotification(), false);
}
}
@@ -454,7 +454,7 @@
// processed by this thread will use either a new or a recycled
// processor.
connections.put(socket, processor);
- proto.endpoint.getCometPoller().add(socket, processor.getTimeout(), false,
+ proto.endpoint.getEventPoller().add(socket, processor.getTimeout(), false,
false, processor.getResumeNotification(), false);
} else {
recycledProcessors.offer(processor);
Modified: trunk/java/org/apache/coyote/ajp/AjpProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -272,17 +272,17 @@
/**
- * Comet used.
+ * Event used.
*/
- protected boolean comet = false;
+ protected boolean event = false;
/**
- * Comet processing.
+ * Event processing.
*/
- protected boolean cometProcessing = true;
- public void startProcessing() { cometProcessing = true; }
- public void endProcessing() { cometProcessing = false; }
+ protected boolean eventProcessing = true;
+ public void startProcessing() { eventProcessing = true; }
+ public void endProcessing() { eventProcessing = false; }
// ----------------------------------------------------- Static Initializer
@@ -406,7 +406,7 @@
if (error) {
recycle();
return SocketState.CLOSED;
- } else if (!comet) {
+ } else if (!event) {
finish();
recycle();
return SocketState.OPEN;
@@ -439,7 +439,7 @@
// Error flag
error = false;
- while (!error && !comet) {
+ while (!error && !event) {
// Parsing the request header
try {
@@ -513,7 +513,7 @@
}
// Finish the response if not done yet
- if (!comet && !finished) {
+ if (!event && !finished) {
try {
finish();
} catch (Throwable t) {
@@ -528,7 +528,7 @@
}
request.updateCounters();
- if (!comet) {
+ if (!event) {
recycle();
}
@@ -538,14 +538,14 @@
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (comet) {
+ if (event) {
if (error) {
input = null;
output = null;
recycle();
return SocketState.CLOSED;
} else {
- cometProcessing = false;
+ eventProcessing = false;
return SocketState.LONG;
}
} else {
@@ -675,20 +675,20 @@
empty = false;
replay = true;
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
- comet = true;
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
- comet = false;
- } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_BEGIN) {
+ event = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_END) {
+ event = false;
+ } else if (actionCode == ActionCode.ACTION_EVENT_SUSPEND) {
// No action needed
- } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_RESUME) {
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
- if (!cometProcessing && !resumeNotification) {
- endpoint.getPoller().add(socket, timeout, true, true);
+ if (!eventProcessing && !resumeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, true, true);
}
resumeNotification = true;
- } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
timeout = ((Integer) param).intValue();
}
@@ -1228,7 +1228,7 @@
finished = false;
timeout = -1;
resumeNotification = false;
- cometProcessing = true;
+ eventProcessing = true;
request.recycle();
response.recycle();
certificates.recycle();
Modified: trunk/java/org/apache/coyote/ajp/AjpProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/ajp/AjpProtocol.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -413,15 +413,9 @@
if (state != SocketState.LONG) {
connections.remove(socket);
recycledProcessors.offer(result);
- // FIXME: if the socket is still open, we should send it back to reprocess it
- // as if it was an initial request, or the simple solution is to close after
- // an async request; will see
- if (proto.endpoint.isRunning() && state == SocketState.OPEN) {
- //proto.endpoint.getPoller().add(socket);
- }
} else {
if (proto.endpoint.isRunning()) {
- proto.endpoint.getPoller().add(socket, result.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
result.getResumeNotification(), false);
}
}
@@ -445,7 +439,7 @@
// processed by this thread will use either a new or a recycled
// processor.
connections.put(socket, processor);
- proto.endpoint.getPoller().add(socket, processor.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, processor.getTimeout(),
processor.getResumeNotification(), false);
} else {
recycledProcessors.offer(processor);
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -179,9 +179,9 @@
/**
- * Comet used.
+ * Event used.
*/
- protected boolean comet = false;
+ protected boolean event = false;
/**
@@ -321,19 +321,19 @@
protected boolean readNotifications = true;
protected boolean writeNotification = false;
protected boolean resumeNotification = false;
- protected boolean cometProcessing = true;
+ protected boolean eventProcessing = true;
// ------------------------------------------------------------- Properties
public void startProcessing() {
- cometProcessing = true;
+ eventProcessing = true;
}
public void endProcessing() {
- cometProcessing = false;
+ eventProcessing = false;
}
@@ -785,7 +785,7 @@
outputBuffer.nextRequest();
recycle();
return SocketState.CLOSED;
- } else if (!comet) {
+ } else if (!event) {
endRequest();
boolean pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
@@ -822,7 +822,7 @@
// Error flag
error = false;
- comet = false;
+ event = false;
keepAlive = true;
int keepAliveLeft = maxKeepAliveRequests;
@@ -831,7 +831,7 @@
boolean keptAlive = false;
boolean openSocket = false;
- while (!error && keepAlive && !comet) {
+ while (!error && keepAlive && !event) {
// Parsing the request header
try {
@@ -910,7 +910,7 @@
// If there is an unspecified error, the connection will be closed
inputBuffer.setSwallowInput(false);
}
- if (!comet) {
+ if (!event) {
endRequest();
}
@@ -922,7 +922,7 @@
request.updateCounters();
boolean pipelined = false;
- if (!comet) {
+ if (!event) {
// Next request
pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
@@ -944,14 +944,14 @@
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (comet) {
+ if (event) {
if (error) {
inputBuffer.nextRequest();
outputBuffer.nextRequest();
recycle();
return SocketState.CLOSED;
} else {
- cometProcessing = false;
+ eventProcessing = false;
return SocketState.LONG;
}
} else {
@@ -995,7 +995,7 @@
readNotifications = true;
writeNotification = false;
resumeNotification = false;
- cometProcessing = true;
+ eventProcessing = true;
}
@@ -1059,7 +1059,7 @@
// End the processing of the current request, and stop any further
// transactions with the client
- comet = false;
+ event = false;
try {
outputBuffer.endRequest();
} catch (IOException e) {
@@ -1236,38 +1236,38 @@
} else if (actionCode == ActionCode.ACTION_AVAILABLE) {
inputBuffer.useAvailable();
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
- comet = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_BEGIN) {
+ event = true;
// Set socket to non blocking mode
Socket.timeoutSet(socket, 0);
outputBuffer.setNonBlocking(true);
inputBuffer.setNonBlocking(true);
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
- comet = false;
+ } else if (actionCode == ActionCode.ACTION_EVENT_END) {
+ event = false;
// End non blocking mode
outputBuffer.setNonBlocking(false);
inputBuffer.setNonBlocking(false);
if (!error) {
Socket.timeoutSet(socket, endpoint.getSoTimeout() * 1000);
}
- } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_SUSPEND) {
readNotifications = false;
- } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_RESUME) {
readNotifications = true;
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
- if (!cometProcessing && !resumeNotification) {
- endpoint.getCometPoller().add(socket, timeout, false, false, true, true);
+ if (!eventProcessing && !resumeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, false, false, true, true);
}
resumeNotification = true;
- } else if (actionCode == ActionCode.ACTION_COMET_WRITE) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_WRITE) {
// An event is being processed already: adding for write will be done
// when the socket gets back to the poller
- if (!cometProcessing && !writeNotification) {
- endpoint.getCometPoller().add(socket, timeout, false, true, false, true);
+ if (!eventProcessing && !writeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, false, true, false, true);
}
writeNotification = true;
- } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
timeout = ((Integer) param).intValue();
}
Modified: trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -579,7 +579,7 @@
}
} else {
if (proto.endpoint.isRunning()) {
- proto.endpoint.getCometPoller().add(socket, result.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
result.getReadNotifications(), result.getWriteNotification(), result.getResumeNotification(), false);
}
}
@@ -606,7 +606,7 @@
// Call a read event right away
state = event(socket, SocketStatus.OPEN_READ);
} else {
- proto.endpoint.getCometPoller().add(socket, processor.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, processor.getTimeout(),
processor.getReadNotifications(), false, processor.getResumeNotification(), false);
}
} else {
Modified: trunk/java/org/apache/coyote/http11/Http11Processor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/http11/Http11Processor.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -305,9 +305,9 @@
/**
- * Comet used.
+ * Event used.
*/
- protected boolean comet = false;
+ protected boolean event = false;
/**
@@ -317,11 +317,11 @@
/**
- * Comet processing.
+ * Event processing.
*/
- protected boolean cometProcessing = true;
- public void startProcessing() { cometProcessing = true; }
- public void endProcessing() { cometProcessing = false; }
+ protected boolean eventProcessing = true;
+ public void startProcessing() { eventProcessing = true; }
+ public void endProcessing() { eventProcessing = false; }
// ------------------------------------------------------------- Properties
@@ -766,7 +766,7 @@
outputBuffer.nextRequest();
recycle();
return SocketState.CLOSED;
- } else if (!comet) {
+ } else if (!event) {
endRequest();
boolean pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
@@ -829,7 +829,7 @@
boolean keptAlive = false;
- while (!error && keepAlive && !comet) {
+ while (!error && keepAlive && !event) {
// Parsing the request header
try {
@@ -906,7 +906,7 @@
// If there is an unspecified error, the connection will be closed
inputBuffer.setSwallowInput(false);
}
- if (!comet) {
+ if (!event) {
endRequest();
}
@@ -917,7 +917,7 @@
}
request.updateCounters();
- if (!comet) {
+ if (!event) {
// Next request
inputBuffer.nextRequest();
outputBuffer.nextRequest();
@@ -929,14 +929,14 @@
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (comet) {
+ if (event) {
if (error) {
inputBuffer.nextRequest();
outputBuffer.nextRequest();
recycle();
return SocketState.CLOSED;
} else {
- cometProcessing = false;
+ eventProcessing = false;
return SocketState.LONG;
}
} else {
@@ -979,7 +979,7 @@
sslSupport = null;
timeout = -1;
resumeNotification = false;
- cometProcessing = true;
+ eventProcessing = true;
}
@@ -1165,20 +1165,20 @@
InternalInputBuffer internalBuffer = (InternalInputBuffer)
request.getInputBuffer();
internalBuffer.addActiveFilter(savedBody);
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
- comet = true;
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
- comet = false;
- } else if (actionCode == ActionCode.ACTION_COMET_SUSPEND) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_BEGIN) {
+ event = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_END) {
+ event = false;
+ } else if (actionCode == ActionCode.ACTION_EVENT_SUSPEND) {
// No action needed
- } else if (actionCode == ActionCode.ACTION_COMET_RESUME) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_RESUME) {
// An event is being processed already: adding for resume will be done
// when the socket gets back to the poller
- if (!cometProcessing && !resumeNotification) {
- endpoint.getPoller().add(socket, timeout, true, true);
+ if (!eventProcessing && !resumeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, true, true);
}
resumeNotification = true;
- } else if (actionCode == ActionCode.ACTION_COMET_TIMEOUT) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
timeout = ((Integer) param).intValue();
}
Modified: trunk/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/http11/Http11Protocol.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -623,15 +623,9 @@
if (state != SocketState.LONG) {
connections.remove(socket);
recycledProcessors.offer(result);
- // FIXME: if the socket is still open, we should send it back to reprocess it
- // as if it was an initial request, or the simple solution is to close after
- // an async request; will see
- if (proto.endpoint.isRunning() && state == SocketState.OPEN) {
- //proto.endpoint.getPoller().add(socket);
- }
} else {
if (proto.endpoint.isRunning()) {
- proto.endpoint.getPoller().add(socket, result.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, result.getTimeout(),
result.getResumeNotification(), false);
}
}
@@ -662,7 +656,7 @@
// processed by this thread will use either a new or a recycled
// processor.
connections.put(socket, processor);
- proto.endpoint.getPoller().add(socket, processor.getTimeout(),
+ proto.endpoint.getEventPoller().add(socket, processor.getTimeout(),
processor.getResumeNotification(), false);
} else {
recycledProcessors.offer(processor);
Modified: trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -534,7 +534,7 @@
}
- // If non blocking (comet) and there are leftover bytes,
+ // If non blocking (event) and there are leftover bytes,
// and lastWrite was 0 -> error
if (leftover.getLength() > 0 && !(Http11AprProcessor.containerThread.get() == Boolean.TRUE)) {
throw new IOException(sm.getString("oob.backlog"));
@@ -835,7 +835,7 @@
// Call for a write event because it is possible that no further write
// operations are made
if (!response.getFlushLeftovers()) {
- response.action(ActionCode.ACTION_COMET_WRITE, null);
+ response.action(ActionCode.ACTION_EVENT_WRITE, null);
}
}
}
@@ -869,7 +869,7 @@
public int doWrite(ByteChunk chunk, Response res)
throws IOException {
- // If non blocking (comet) and there are leftover bytes,
+ // If non blocking (event) and there are leftover bytes,
// put all remaining bytes in the leftover buffer (they are
// part of the same write operation)
if (leftover.getLength() > 0) {
@@ -885,7 +885,7 @@
if (bbuf.position() == bbuf.capacity()) {
flushBuffer();
if (leftover.getLength() > 0) {
- // If non blocking (comet) and there are leftover bytes,
+ // If non blocking (event) and there are leftover bytes,
// put all remaining bytes in the leftover buffer (they are
// part of the same write operation)
int oldStart = chunk.getOffset();
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -43,17 +43,14 @@
import org.jboss.logging.Logger;
/**
- * APR tailored thread pool, providing the following services:
+ * APR endpoint, providing the following services:
* <ul>
* <li>Socket acceptor thread</li>
* <li>Socket poller thread</li>
* <li>Sendfile thread</li>
- * <li>Worker threads pool</li>
+ * <li>Simple Worker thread pool, with possible use of executors</li>
* </ul>
*
- * When switching to Java 5, there's an opportunity to use the virtual
- * machine's thread pool.
- *
* @author Mladen Turk
* @author Remy Maucherat
*/
@@ -321,11 +318,11 @@
/**
- * The socket poller used for Comet support.
+ * The socket poller used for event support.
*/
- protected Poller cometPoller = null;
- public Poller getCometPoller() {
- return cometPoller;
+ protected Poller eventPoller = null;
+ public Poller getEventPoller() {
+ return eventPoller;
}
@@ -695,13 +692,13 @@
pollerThread.setDaemon(true);
pollerThread.start();
- // Start comet poller thread
- cometPoller = new Poller(true);
- cometPoller.init();
- Thread cometPollerThread = new Thread(cometPoller, getName() + "-CometPoller");
- cometPollerThread.setPriority(threadPriority);
- cometPollerThread.setDaemon(true);
- cometPollerThread.start();
+ // Start event poller thread
+ eventPoller = new Poller(true);
+ eventPoller.init();
+ Thread eventPollerThread = new Thread(eventPoller, getName() + "-EventPoller");
+ eventPollerThread.setPriority(threadPriority);
+ eventPollerThread.setDaemon(true);
+ eventPollerThread.start();
// Start sendfile thread
if (useSendfile) {
@@ -754,8 +751,8 @@
unlockAccept();
poller.destroy();
poller = null;
- cometPoller.destroy();
- cometPoller = null;
+ eventPoller.destroy();
+ eventPoller = null;
if (useSendfile) {
sendfile.destroy();
sendfile = null;
@@ -1358,9 +1355,9 @@
protected SocketList localAddList = null;
/**
- * Comet mode flag.
+ * Event mode flag.
*/
- protected boolean comet = true;
+ protected boolean event = true;
/**
* Structure used for storing timeouts.
@@ -1380,8 +1377,8 @@
protected int connectionCount = 0;
public int getConnectionCount() { return connectionCount; }
- public Poller(boolean comet) {
- this.comet = comet;
+ public Poller(boolean event) {
+ this.event = event;
}
/**
@@ -1455,7 +1452,7 @@
// Close all sockets in the add queue
SocketInfo info = addList.get();
while (info != null) {
- if (!comet || (comet && !processSocket(info.socket, SocketStatus.STOP))) {
+ if (!event || (event && !processSocket(info.socket, SocketStatus.STOP))) {
Socket.destroy(info.socket);
}
info = addList.get();
@@ -1466,7 +1463,7 @@
int rv = Poll.pollset(pollers[i], desc);
if (rv > 0) {
for (int n = 0; n < rv; n++) {
- if (!comet || (comet && !processSocket(desc[n*2+1], SocketStatus.STOP))) {
+ if (!event || (event && !processSocket(desc[n*2+1], SocketStatus.STOP))) {
Socket.destroy(desc[n*2+1]);
}
}
@@ -1500,7 +1497,7 @@
}
if (!ok) {
// Can't do anything: close the socket right away
- if (!comet || (comet && !processSocket(socket, SocketStatus.ERROR))) {
+ if (!event || (event && !processSocket(socket, SocketStatus.ERROR))) {
Socket.destroy(socket);
}
}
@@ -1538,7 +1535,7 @@
}
if (!ok) {
// Can't do anything: close the socket right away
- if (!comet || (comet && !processSocket(socket, SocketStatus.ERROR))) {
+ if (!event || (event && !processSocket(socket, SocketStatus.ERROR))) {
Socket.destroy(socket);
}
}
@@ -1595,7 +1592,7 @@
long socket = timeouts.check(date);
while (socket != 0) {
removeFromPoller(socket);
- if (!comet || (comet && !processSocket(socket, SocketStatus.TIMEOUT))) {
+ if (!event || (event && !processSocket(socket, SocketStatus.TIMEOUT))) {
Socket.destroy(socket);
}
socket = timeouts.check(date);
@@ -1608,7 +1605,7 @@
*/
public String toString() {
StringBuffer buf = new StringBuffer();
- buf.append("Poller comet=[").append(comet).append("]");
+ buf.append("Poller event=[").append(event).append("]");
long[] res = new long[actualPollerSize * 2];
for (int i = 0; i < pollers.length; i++) {
int count = Poll.pollset(pollers[i], res);
@@ -1679,7 +1676,7 @@
| ((info.write()) ? Poll.APR_POLLOUT : 0);
if (!addToPoller(info.socket, events)) {
// Can't do anything: close the socket right away
- if (!comet || (comet && !processSocket(info.socket, SocketStatus.ERROR))) {
+ if (!event || (event && !processSocket(info.socket, SocketStatus.ERROR))) {
Socket.destroy(info.socket);
}
} else {
@@ -1697,14 +1694,14 @@
}
} else {
// Store timeout
- if (comet) {
+ if (event) {
removeFromPoller(info.socket);
}
int events = ((info.read()) ? Poll.APR_POLLIN : 0)
| ((info.write()) ? Poll.APR_POLLOUT : 0);
if (!addToPoller(info.socket, events)) {
// Can't do anything: close the socket right away
- if (!comet || (comet && !processSocket(info.socket, SocketStatus.ERROR))) {
+ if (!event || (event && !processSocket(info.socket, SocketStatus.ERROR))) {
Socket.destroy(info.socket);
}
} else {
@@ -1713,7 +1710,7 @@
}
} else {
// This is either a resume or a suspend.
- if (comet) {
+ if (event) {
if (info.resume()) {
// Resume event
timeouts.remove(info.socket);
@@ -1726,7 +1723,7 @@
timeouts.add(info.socket, System.currentTimeMillis() + info.timeout);
}
} else {
- // Should never happen, if not Comet, the socket is always put in
+ // Should never happen, if not event, the socket is always put in
// the list with the read flag.
timeouts.remove(info.socket);
Socket.destroy(info.socket);
@@ -1742,7 +1739,7 @@
// Flags to ask to reallocate the pool
boolean reset = false;
- ArrayList<Long> skip = null;
+ //ArrayList<Long> skip = null;
int rv = 0;
// Iterate on each pollers, but no need to poll empty pollers
@@ -1755,8 +1752,8 @@
for (int n = 0; n < rv; n++) {
timeouts.remove(desc[n*2+1]);
// Check for failed sockets and hand this socket off to a worker
- if (comet) {
- // Comet processes either a read or a write depending on what the poller returns
+ if (event) {
+ // Event processes either a read or a write depending on what the poller returns
if (((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
|| ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)) {
if (!processSocket(desc[n*2+1], SocketStatus.ERROR)) {
@@ -1844,7 +1841,7 @@
// Process socket timeouts
if (soTimeout > 0 && maintain++ > 1000 && running) {
// This works and uses only one timeout mechanism for everything, but the
- // non Comet poller might be a bit faster by using the old maintain.
+ // non event poller might be a bit faster by using the old maintain.
maintain = 0;
maintain();
}
Modified: trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java 2009-03-20 17:26:19 UTC (rev 966)
@@ -29,7 +29,6 @@
import java.net.Socket;
import java.util.concurrent.Executor;
-import org.apache.tomcat.util.net.AprEndpoint.SocketInfo;
import org.apache.tomcat.util.res.StringManager;
import org.jboss.logging.Logger;
@@ -270,11 +269,11 @@
/**
- * The socket poller.
+ * The socket poller used for event support.
*/
- protected Poller poller = null;
- public Poller getPoller() {
- return poller;
+ protected Poller eventPoller = null;
+ public Poller getEventPoller() {
+ return eventPoller;
}
@@ -570,10 +569,18 @@
public void run() {
- // Process the request from this socket
- if (handler.event(socket, status) == Handler.SocketState.CLOSED) {
+ Handler.SocketState socketState = handler.event(socket, status);
+ if (socketState == Handler.SocketState.CLOSED) {
// Close socket
try { socket.close(); } catch (IOException e) { }
+ } else if (socketState == Handler.SocketState.OPEN) {
+ // Process the keepalive after the event processing
+ // This is the main behavior difference with endpoint with pollers, which
+ // will add the socket to the poller
+ if (handler.process(socket) == Handler.SocketState.CLOSED) {
+ // Close socket
+ try { socket.close(); } catch (IOException e) { }
+ }
}
socket = null;
@@ -802,8 +809,6 @@
// Process socket timeouts
if (soTimeout > 0 && maintain++ > 1000 && running) {
- // This works and uses only one timeout mechanism for everything, but the
- // non Comet poller might be a bit faster by using the old maintain.
maintain = 0;
maintain();
}
@@ -925,10 +930,20 @@
continue;
// Process the request from this socket
- if ((status != null) && (handler.event(socket, status) == Handler.SocketState.CLOSED)) {
- // FIXME: If handler.event returns Handler.SocketState.OPEN, then likely should process without socketOptions
- // Close socket
- try { socket.close(); } catch (IOException e) { }
+ if (status != null){
+ Handler.SocketState socketState = handler.event(socket, status);
+ if (socketState == Handler.SocketState.CLOSED) {
+ // Close socket
+ try { socket.close(); } catch (IOException e) { }
+ } else if (socketState == Handler.SocketState.OPEN) {
+ // Process the keepalive after the event processing
+ // This is the main behavior difference with endpoint with pollers, which
+ // will add the socket to the poller
+ if (handler.process(socket) == Handler.SocketState.CLOSED) {
+ // Close socket
+ try { socket.close(); } catch (IOException e) { }
+ }
+ }
} else if ((status == null) && (!setSocketOptions(socket) || (handler.process(socket) == Handler.SocketState.CLOSED))) {
// Close socket
try { socket.close(); } catch (IOException e) { }
@@ -1009,10 +1024,10 @@
workers = new WorkerStack(maxThreads);
}
- // Start poller thread
- poller = new Poller();
- poller.init();
- Thread pollerThread = new Thread(poller, getName() + "-Poller");
+ // Start event poller thread
+ eventPoller = new Poller();
+ eventPoller.init();
+ Thread pollerThread = new Thread(eventPoller, getName() + "-Poller");
pollerThread.setPriority(threadPriority);
pollerThread.setDaemon(true);
pollerThread.start();
@@ -1044,8 +1059,8 @@
if (running) {
running = false;
unlockAccept();
- poller.destroy();
- poller = null;
+ eventPoller.destroy();
+ eventPoller = null;
}
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-19 18:30:09 UTC (rev 965)
+++ trunk/webapps/docs/changelog.xml 2009-03-20 17:26:19 UTC (rev 966)
@@ -41,10 +41,6 @@
<fix>
<bug>46866</bug>: Use nanoTime rather that a weaker init for the Random fallback. (remm)
</fix>
- <update>
- Add support for events to all connectors (IO events are only available on
- the APR HTTP connector, of course). (remm)
- </update>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -52,6 +48,9 @@
<fix>
Remove useless instanceof in the HTTP protocol. (markt)
</fix>
+ <update>
+ Add support for non IO events in all connectors. (remm)
+ </update>
</changelog>
</subsection>
</section>
15 years, 9 months
JBossWeb SVN: r965 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2009-03-19 14:30:09 -0400 (Thu, 19 Mar 2009)
New Revision: 965
Modified:
trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
trunk/webapps/docs/changelog.xml
Log:
- 46875: fix possible ISE on session access.
- Also use the regular close so that it goes in a container thread later, directly calling webapp code is evil.
Modified: trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-19 00:54:32 UTC (rev 964)
+++ trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2009-03-19 18:30:09 UTC (rev 965)
@@ -35,13 +35,11 @@
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.HttpEventImpl;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.jboss.servlet.http.HttpEvent;
-import org.jboss.servlet.http.HttpEventServlet;
/**
@@ -201,14 +199,15 @@
// serializable or required.
HttpSession session = request.getSession(false);
if (session != null) {
- session.removeAttribute(cometRequestsAttribute);
+ try {
+ session.removeAttribute(cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
// Close the comet connection
try {
- HttpEventImpl cometEvent = request.getEvent();
- cometEvent.setType(HttpEvent.EventType.END);
- getNext().event(request, request.getResponse(), cometEvent);
- cometEvent.close();
+ request.getEvent().close();
} catch (Exception e) {
container.getLogger().warn(
sm.getString("cometConnectionManagerValve.event"),
@@ -328,8 +327,12 @@
session.setAttribute(cometRequestsAttribute,
newConnectionInfos);
} else {
- session.removeAttribute(
- cometRequestsAttribute);
+ try {
+ session.removeAttribute(
+ cometRequestsAttribute);
+ } catch (IllegalStateException e) {
+ // Ignore
+ }
}
}
}
@@ -353,10 +356,7 @@
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
- HttpEventImpl event = req.getEvent();
- event.setType(HttpEvent.EventType.END);
- ((HttpEventServlet) req.getWrapper().getServlet()).event(event);
- event.close();
+ req.getEvent().close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-03-19 00:54:32 UTC (rev 964)
+++ trunk/webapps/docs/changelog.xml 2009-03-19 18:30:09 UTC (rev 965)
@@ -66,6 +66,9 @@
<fix>
NPE in various realms. (markt)
</fix>
+ <fix>
+ <bug>46875</bug>: ISE on session access in Comet valve. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
15 years, 9 months