You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2004/10/05 19:12:52 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session StandardManager.java mbeans-descriptors.xml
remm 2004/10/05 10:12:52
Modified: catalina/src/share/org/apache/catalina/startup
HostConfig.java
catalina/src/share/org/apache/catalina/valves ValveBase.java
catalina/src/share/org/apache/catalina Lifecycle.java
Loader.java Realm.java Valve.java Cluster.java
catalina/src/share/org/apache/catalina/loader
WebappLoader.java
modules/cluster/src/share/org/apache/catalina/cluster/tcp
SimpleTcpCluster.java
catalina/src/share/org/apache/catalina/core
mbeans-descriptors.xml ContainerBase.java
StandardContext.java StandardHost.java
LocalStrings.properties
webapps/docs/config manager.xml context.xml
catalina/src/share/org/apache/catalina/realm RealmBase.java
catalina/src/share/org/apache/catalina/session
StandardManager.java mbeans-descriptors.xml
Log:
- Extend background processing to most components.
- The frequency check field moves to the manager.
Revision Changes Path
1.48 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java
Index: HostConfig.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/HostConfig.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- HostConfig.java 24 Sep 2004 07:25:06 -0000 1.47
+++ HostConfig.java 5 Oct 2004 17:12:49 -0000 1.48
@@ -288,7 +288,7 @@
*/
public void lifecycleEvent(LifecycleEvent event) {
- if (event.getType().equals("check"))
+ if (event.getType().equals(Lifecycle.PERIODIC_EVENT))
check();
// Identify the host we are associated with
1.16 +10 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java
Index: ValveBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ValveBase.java 29 Aug 2004 16:46:14 -0000 1.15
+++ ValveBase.java 5 Oct 2004 17:12:49 -0000 1.16
@@ -149,6 +149,15 @@
/**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess() {
+ }
+
+
+ /**
* The implementation-specific logic represented by this Valve. See the
* Valve description for the normal design patterns for this method.
* <p>
1.4 +7 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Lifecycle.java
Index: Lifecycle.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Lifecycle.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Lifecycle.java 23 Jul 2004 22:57:35 -0000 1.3
+++ Lifecycle.java 5 Oct 2004 17:12:49 -0000 1.4
@@ -82,6 +82,12 @@
public static final String DESTROY_EVENT = "destroy";
+ /**
+ * The LifecycleEvent type for the "periodic" event.
+ */
+ public static final String PERIODIC_EVENT = "periodic";
+
+
// --------------------------------------------------------- Public Methods
1.5 +9 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Loader.java
Index: Loader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Loader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Loader.java 16 Aug 2004 09:31:07 -0000 1.4
+++ Loader.java 5 Oct 2004 17:12:49 -0000 1.5
@@ -59,6 +59,14 @@
/**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess();
+
+
+ /**
* Return the Java class loader to be used by this Container.
*/
public ClassLoader getClassLoader();
1.10 +12 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Realm.java
Index: Realm.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Realm.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Realm.java 23 Jun 2004 08:24:59 -0000 1.9
+++ Realm.java 5 Oct 2004 17:12:49 -0000 1.10
@@ -125,6 +125,15 @@
*/
public Principal authenticate(X509Certificate certs[]);
+
+ /**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess();
+
+
/**
* Return the SecurityConstraints configured to guard the request URI for
* this request, or <code>null</code> if there is no such constraint.
@@ -133,6 +142,8 @@
*/
public SecurityConstraint [] findSecurityConstraints(Request request,
Context context);
+
+
/**
* Perform access control based on the specified authorization constraint.
* Return <code>true</code> if this constraint is satisfied and processing
1.5 +9 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Valve.java
Index: Valve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Valve.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Valve.java 29 Aug 2004 16:46:08 -0000 1.4
+++ Valve.java 5 Oct 2004 17:12:49 -0000 1.5
@@ -71,6 +71,14 @@
/**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess();
+
+
+ /**
* <p>Perform request processing as required by this Valve.</p>
*
* <p>An individual Valve <b>MAY</b> perform the following actions, in
1.9 +11 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Cluster.java
Index: Cluster.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Cluster.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Cluster.java 23 Jun 2004 14:00:04 -0000 1.8
+++ Cluster.java 5 Oct 2004 17:12:49 -0000 1.9
@@ -100,6 +100,16 @@
public Manager createManager(String name);
// --------------------------------------------------------- Cluster Wide Deployments
+
+
+ /**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess();
+
+
/**
* Start an existing web application, attached to the specified context
* path in all the other nodes in the cluster.
1.33 +26 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
Index: WebappLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- WebappLoader.java 16 Aug 2004 09:31:09 -0000 1.32
+++ WebappLoader.java 5 Oct 2004 17:12:50 -0000 1.33
@@ -390,6 +390,31 @@
/**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess() {
+ if (reloadable && modified()) {
+ try {
+ Thread.currentThread().setContextClassLoader
+ (WebappLoader.class.getClassLoader());
+ if (container instanceof StandardContext) {
+ ((StandardContext) container).reload();
+ }
+ } finally {
+ if (container.getLoader() != null) {
+ Thread.currentThread().setContextClassLoader
+ (container.getLoader().getClassLoader());
+ }
+ }
+ } else {
+ closeJARs(false);
+ }
+ }
+
+
+ /**
* Return the set of repositories defined for this class loader.
* If none are defined, a zero-length array is returned.
* For security reason, returns a clone of the Array (since
1.51 +10 -1 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
Index: SimpleTcpCluster.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- SimpleTcpCluster.java 29 Sep 2004 16:43:44 -0000 1.50
+++ SimpleTcpCluster.java 5 Oct 2004 17:12:50 -0000 1.51
@@ -320,6 +320,15 @@
/**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess() {
+ }
+
+
+ /**
* Get the lifecycle listeners associated with this lifecycle. If this
* Lifecycle has no listeners registered, a zero-length array is returned.
*/
1.37 +0 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml
Index: mbeans-descriptors.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/mbeans-descriptors.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mbeans-descriptors.xml 3 Oct 2004 08:53:56 -0000 1.36
+++ mbeans-descriptors.xml 5 Oct 2004 17:12:50 -0000 1.37
@@ -117,10 +117,6 @@
description="Associated manager."
type="org.apache.catalina.Manager" />
- <attribute name="managerChecksFrequency"
- description="The frequency of the manager checks (expiration and passivation)"
- type="int"/>
-
<attribute name="mappingObject"
description="The object used for mapping"
type="java.lang.Object"/>
1.37 +42 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java
Index: ContainerBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ContainerBase.java 24 Jun 2004 15:28:27 -0000 1.36
+++ ContainerBase.java 5 Oct 2004 17:12:50 -0000 1.37
@@ -1249,6 +1249,48 @@
* throwables will be caught and logged.
*/
public void backgroundProcess() {
+
+ if (!started)
+ return;
+
+ if (cluster != null) {
+ try {
+ cluster.backgroundProcess();
+ } catch (Exception e) {
+ log.warn(sm.getString("containerBase.backgroundProcess.cluster", cluster), e);
+ }
+ }
+ if (loader != null) {
+ try {
+ loader.backgroundProcess();
+ } catch (Exception e) {
+ log.warn(sm.getString("containerBase.backgroundProcess.loader", loader), e);
+ }
+ }
+ if (manager != null) {
+ try {
+ manager.backgroundProcess();
+ } catch (Exception e) {
+ log.warn(sm.getString("containerBase.backgroundProcess.manager", manager), e);
+ }
+ }
+ if (realm != null) {
+ try {
+ realm.backgroundProcess();
+ } catch (Exception e) {
+ log.warn(sm.getString("containerBase.backgroundProcess.realm", realm), e);
+ }
+ }
+ Valve current = pipeline.getFirst();
+ while (current != null) {
+ try {
+ current.backgroundProcess();
+ } catch (Exception e) {
+ log.warn(sm.getString("containerBase.backgroundProcess.valve", current), e);
+ }
+ current = current.getNext();
+ }
+ lifecycle.fireLifecycleEvent(Lifecycle.PERIODIC_EVENT, null);
}
1.153 +1 -87 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- StandardContext.java 3 Oct 2004 08:53:55 -0000 1.152
+++ StandardContext.java 5 Oct 2004 17:12:50 -0000 1.153
@@ -544,21 +544,6 @@
/**
- * Frequency of the session expiration, and related manager operations.
- * Manager operations will be done once for the specified amount of
- * backgrondProcess calls (ie, the lower the amount, the most often the
- * checks will occur).
- */
- private int managerChecksFrequency = 6;
-
-
- /**
- * Iteration count for background processing.
- */
- private int count = 0;
-
-
- /**
* Caching allowed flag.
*/
private boolean cachingAllowed = true;
@@ -1216,36 +1201,6 @@
/**
- * Return the frequency of manager checks.
- */
- public int getManagerChecksFrequency() {
-
- return (this.managerChecksFrequency);
-
- }
-
-
- /**
- * Set the manager checks frequency.
- *
- * @param managerChecksFrequency the new manager checks frequency
- */
- public void setManagerChecksFrequency(int managerChecksFrequency) {
-
- if (managerChecksFrequency <= 0) {
- return;
- }
-
- int oldManagerChecksFrequency = this.managerChecksFrequency;
- this.managerChecksFrequency = managerChecksFrequency;
- support.firePropertyChange("managerChecksFrequency",
- new Integer(oldManagerChecksFrequency),
- new Integer(this.managerChecksFrequency));
-
- }
-
-
- /**
* Return descriptive information about this Container implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
@@ -4392,47 +4347,6 @@
sb.append(getName());
sb.append("]");
return (sb.toString());
-
- }
-
-
- /**
- * Execute a periodic task, such as reloading, etc. This method will be
- * invoked inside the classloading context of this container. Unexpected
- * throwables will be caught and logged.
- */
- public void backgroundProcess() {
-
- if (!started)
- return;
-
- count = (count + 1) % managerChecksFrequency;
-
- if ((getManager() != null) && (count == 0)) {
- try {
- getManager().backgroundProcess();
- } catch ( Exception x ) {
- log.warn("Unable to perform background process on manager",x);
- }
- }
-
- if (getLoader() != null) {
- if (reloadable && (getLoader().modified())) {
- try {
- Thread.currentThread().setContextClassLoader
- (StandardContext.class.getClassLoader());
- reload();
- } finally {
- if (getLoader() != null) {
- Thread.currentThread().setContextClassLoader
- (getLoader().getClassLoader());
- }
- }
- }
- if (getLoader() instanceof WebappLoader) {
- ((WebappLoader) getLoader()).closeJARs(false);
- }
- }
}
1.35 +1 -11 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java
Index: StandardHost.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- StandardHost.java 16 Aug 2004 09:31:06 -0000 1.34
+++ StandardHost.java 5 Oct 2004 17:12:51 -0000 1.35
@@ -720,16 +720,6 @@
}
- /**
- * Execute a periodic task, such as reloading, etc. This method will be
- * invoked inside the classloading context of this container. Unexpected
- * throwables will be caught and logged.
- */
- public void backgroundProcess() {
- lifecycle.fireLifecycleEvent("check", null);
- }
-
-
// -------------------- JMX --------------------
/**
* Return the MBean Names of the Valves assoicated with this Host
1.14 +5 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- LocalStrings.properties 22 Sep 2004 15:28:06 -0000 1.13
+++ LocalStrings.properties 5 Oct 2004 17:12:51 -0000 1.14
@@ -17,6 +17,11 @@
containerBase.alreadyStarted=Container {0} has already been started
containerBase.notConfigured=No basic Valve has been configured
containerBase.notStarted=Container {0} has not been started
+containerBase.backgroundProcess.cluster=Exception processing cluster {0} background process
+containerBase.backgroundProcess.loader=Exception processing loader {0} background process
+containerBase.backgroundProcess.manager=Exception processing manager {0} background process
+containerBase.backgroundProcess.realm=Exception processing realm {0} background process
+containerBase.backgroundProcess.valve=Exception processing valve {0} background process
fastEngineMapper.alreadyStarted=FastEngineMapper {0} has already been started
fastEngineMapper.notStarted=FastEngineMapper {0} has not yet been started
filterChain.filter=Filter execution threw an exception
1.9 +8 -0 jakarta-tomcat-catalina/webapps/docs/config/manager.xml
Index: manager.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/manager.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- manager.xml 1 Sep 2004 22:04:29 -0000 1.8
+++ manager.xml 5 Oct 2004 17:12:52 -0000 1.9
@@ -171,6 +171,14 @@
environments.</p>
</attribute>
+ <attribute name="processExpiresFrequency" required="false">
+ <p>Frequency of the session expiration, and related manager operations.
+ Manager operations will be done once for the specified amount of
+ backgrondProcess calls (ie, the lower the amount, the most often the
+ checks will occur). The minimum value is 1, and the default value is 6.
+ </p>
+ </attribute>
+
<attribute name="maxActiveSessions" required="false">
<p>The maximum number of active sessions that will be created by
this Manager, or -1 (the default) for no limit.</p>
1.17 +0 -8 jakarta-tomcat-catalina/webapps/docs/config/context.xml
Index: context.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/context.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- context.xml 27 Sep 2004 16:00:31 -0000 1.16
+++ context.xml 5 Oct 2004 17:12:52 -0000 1.17
@@ -260,14 +260,6 @@
disclosure, among other security problems.</b></p>
</attribute>
- <attribute name="managerChecksFrequency" required="false">
- <p>Frequency of the session expiration, and related manager operations.
- Manager operations will be done once for the specified amount of
- backgrondProcess calls (ie, the lower the amount, the most often the
- checks will occur). The minimum value is 1, and the default value is 6.
- </p>
- </attribute>
-
<attribute name="processTlds" required="false">
<p>Whether the context should process TLDs on startup. The default
is true. The false setting is intended for special cases
1.40 +11 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java
Index: RealmBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/realm/RealmBase.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- RealmBase.java 5 Oct 2004 07:54:07 -0000 1.39
+++ RealmBase.java 5 Oct 2004 17:12:52 -0000 1.40
@@ -368,6 +368,16 @@
}
+
+ /**
+ * Execute a periodic task, such as reloading, etc. This method will be
+ * invoked inside the classloading context of this container. Unexpected
+ * throwables will be caught and logged.
+ */
+ public void backgroundProcess() {
+ }
+
+
/**
* Return the SecurityConstraints configured to guard the request URI for
* this request, or <code>null</code> if there is no such constraint.
1.25 +49 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java
Index: StandardManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- StandardManager.java 7 Sep 2004 21:45:07 -0000 1.24
+++ StandardManager.java 5 Oct 2004 17:12:52 -0000 1.25
@@ -108,6 +108,21 @@
/**
+ * Iteration count for background processing.
+ */
+ private int count = 0;
+
+
+ /**
+ * Frequency of the session expiration, and related manager operations.
+ * Manager operations will be done once for the specified amount of
+ * backgrondProcess calls (ie, the lower the amount, the most often the
+ * checks will occur).
+ */
+ protected int processExpiresFrequency = 6;
+
+
+ /**
* The maximum number of active Sessions allowed, or -1 for no limit.
*/
protected int maxActiveSessions = -1;
@@ -225,6 +240,36 @@
/**
+ * Return the frequency of manager checks.
+ */
+ public int getProcessExpiresFrequency() {
+
+ return (this.processExpiresFrequency);
+
+ }
+
+
+ /**
+ * Set the manager checks frequency.
+ *
+ * @param processExpiresFrequency the new manager checks frequency
+ */
+ public void setProcessExpiresFrequency(int processExpiresFrequency) {
+
+ if (processExpiresFrequency <= 0) {
+ return;
+ }
+
+ int oldProcessExpiresFrequency = this.processExpiresFrequency;
+ this.processExpiresFrequency = processExpiresFrequency;
+ support.firePropertyChange("processExpiresFrequency",
+ new Integer(oldProcessExpiresFrequency),
+ new Integer(this.processExpiresFrequency));
+
+ }
+
+
+ /**
* Set the maximum number of actives Sessions allowed, or -1 for
* no limit.
*
@@ -776,7 +821,9 @@
* Implements the Manager interface, direct call to processExpires
*/
public void backgroundProcess() {
- processExpires();
+ count = (count + 1) % processExpiresFrequency;
+ if (count == 0)
+ processExpires();
}
1.9 +4 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/mbeans-descriptors.xml
Index: mbeans-descriptors.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/mbeans-descriptors.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mbeans-descriptors.xml 7 Sep 2004 20:57:02 -0000 1.8
+++ mbeans-descriptors.xml 5 Oct 2004 17:12:52 -0000 1.9
@@ -43,6 +43,10 @@
created by this Manager"
type="int"/>
+ <attribute name="processExpiresFrequency"
+ description="The frequency of the manager checks (expiration and passivation)"
+ type="int"/>
+
<attribute name="sessionIdLength"
description="The session id length (in bytes) of Sessions
created by this Manager"
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org