tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1391162 - in /tomcat/sandbox/trunk-resources: java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/catalina/webresources/ test/org/apache/catalina/webresources/
Date Thu, 27 Sep 2012 18:57:54 GMT
Author: markt
Date: Thu Sep 27 18:57:53 2012
New Revision: 1391162

URL: http://svn.apache.org/viewvc?rev=1391162&view=rev
Log:
Add the hooks for background processing

Modified:
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/LocalStrings.properties
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
    tomcat/sandbox/trunk-resources/test/org/apache/catalina/webresources/TesterWebResourceRoot.java

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/WebResourceRoot.java Thu Sep 27
18:57:53 2012
@@ -255,6 +255,13 @@ public interface WebResourceRoot extends
      */
     long getCacheTtl();
 
+    /**
+     * This method will be invoked by the context on a periodic basis and allows
+     * the implementation a method that executes periodic tasks, such as purging
+     * expired cache entries.
+     */
+    public void backgroundProcess();
+
     public static enum ResourceSetType {
         PRE,
         RESOURCE_JAR,

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/LocalStrings.properties?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/LocalStrings.properties (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/LocalStrings.properties Thu
Sep 27 18:57:53 2012
@@ -88,6 +88,7 @@ standardContext.applicationListener=Erro
 standardContext.applicationSkipped=Skipped installing application listeners due to previous
error(s)
 standardContext.backgroundProcess.loader=Exception processing loader {0} background process
 standardContext.backgroundProcess.manager=Exception processing manager {0} background process
+standardContext.backgroundProcess.resources=Exception processing resources {0} background
process
 standardContext.cluster.noManager=No manager found. Checking if cluster manager should be
used. Cluster configured: [{0}], Application distributable: [{1}]
 standardContext.duplicateListener=The listener "{0}" is already configured for this context.
The duplicate definition has been ignored.
 standardContext.errorPage.error=Error page location {0} must start with a ''/''

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/core/StandardContext.java Thu
Sep 27 18:57:53 2012
@@ -5471,6 +5471,16 @@ public class StandardContext extends Con
                         e);
             }
         }
+        WebResourceRoot resources = getResources();
+        if (resources != null) {
+            try {
+                resources.backgroundProcess();
+            } catch (Exception e) {
+                log.warn(sm.getString(
+                        "standardContext.backgroundProcess.resources",
+                        resources), e);
+            }
+        }
         super.backgroundProcess();
     }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/Cache.java Thu Sep
27 18:57:53 2012
@@ -52,9 +52,9 @@ public class Cache {
         return result;
     }
 
-    // TODO add background expiration
-
-
+    protected void backgroundProcess() {
+        // TODO expiration
+    }
 
     public long getTtl() {
         return ttl;

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
(original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/StandardRoot.java
Thu Sep 27 18:57:53 2012
@@ -358,6 +358,11 @@ public class StandardRoot extends Lifecy
         return f.getAbsolutePath();
     }
 
+    @Override
+    public void backgroundProcess() {
+        cache.backgroundProcess();
+    }
+
     // ----------------------------------------------------------- JMX Lifecycle
     @Override
     protected String getDomainInternal() {

Modified: tomcat/sandbox/trunk-resources/test/org/apache/catalina/webresources/TesterWebResourceRoot.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/test/org/apache/catalina/webresources/TesterWebResourceRoot.java?rev=1391162&r1=1391161&r2=1391162&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/test/org/apache/catalina/webresources/TesterWebResourceRoot.java
(original)
+++ tomcat/sandbox/trunk-resources/test/org/apache/catalina/webresources/TesterWebResourceRoot.java
Thu Sep 27 18:57:53 2012
@@ -180,4 +180,9 @@ public class TesterWebResourceRoot imple
     public void addPostResources(WebResourceSet webResourceSet) {
         // NO-OP
     }
+
+    @Override
+    public void backgroundProcess() {
+        // NO-OP
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message