cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r642846 - in /cocoon/trunk/core/cocoon-sitemap: cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/ cocoon-sitemap-impl/src/changes/ cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/
Date Mon, 31 Mar 2008 00:18:56 GMT
Author: joerg
Date: Sun Mar 30 17:18:55 2008
New Revision: 642846

URL: http://svn.apache.org/viewvc?rev=642846&view=rev
Log:
COCOON-2109: Fix clean up of continuations.

Modified:
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/changes/changes.xml
    cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java?rev=642846&r1=642845&r2=642846&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-api/src/main/java/org/apache/cocoon/components/flow/WebContinuation.java
Sun Mar 30 17:18:55 2008
@@ -217,7 +217,6 @@
      * @return an <code>Object</code> value
      */
     public Object getContinuation() {
-        updateLastAccessTime();
         return continuation;
     }
 
@@ -234,7 +233,6 @@
      */
     public WebContinuation getContinuation(int level) {
         if (level <= 0) {
-            updateLastAccessTime();
             return this;
         } else if (parentContinuation == null) {
             return this;

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/changes/changes.xml?rev=642846&r1=642845&r2=642846&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/changes/changes.xml (original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/changes/changes.xml Sun Mar 30
17:18:55 2008
@@ -25,6 +25,11 @@
   -->
 <document>
   <body>
+    <release version="1.0.1" date="TBA" description="unreleased">
+      <action dev="joerg" type="fix" fixes-bug="COCOON-2109" due-to="Miguel Cuervo" due-to-email="miguel.cuervo@cgi.com">
+        Fix clean up of continuations.
+      </action>
+    </release>
     <release version="1.0.0" date="TBA" description="released">
       <action dev="gkossakowski" type="fix" issue="COCOON-2070" due-to="Alexander Klimetschek"
due-to-email="alexander.klimetschek@googlemail.com">
         Fixed bug in PoolableProxyHandler class that is responsible for putting components
back to the pool. This bug could lead to the situation

Modified: cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java?rev=642846&r1=642845&r2=642846&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
(original)
+++ cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java
Sun Mar 30 17:18:55 2008
@@ -82,13 +82,13 @@
 
     /**
      * How long does a continuation exist in memory since the last
-     * access? The time is in miliseconds, and the default is 1 hour.
+     * access? The time is in milliseconds, and the default is 1 hour.
      */
     protected int defaultTimeToLive;
 
     /**
      * Maintains the forest of <code>WebContinuation</code> trees.
-     * This set is used only for debugging puroses by
+     * This set is used only for debugging purposes by
      * {@link #displayAllContinuations()} method.
      */
     protected Set forest = Collections.synchronizedSet(new HashSet());
@@ -125,6 +125,10 @@
         bytes = new byte[CONTINUATION_ID_LENGTH];
     }
 
+    public void contextualize(Context context) throws ContextException {
+        this.context = context;        
+    }
+
     public void service(ServiceManager manager) throws ServiceException {
         this.serviceManager = manager;
     }
@@ -211,15 +215,20 @@
     }
 
     public WebContinuation lookupWebContinuation(String id, String interpreterId) {
-        // REVISIT: Is the following check needed to avoid threading issues:
-        // return wk only if !(wk.hasExpired) ?
         WebContinuationsHolder continuationsHolder = lookupWebContinuationsHolder(false);
-        if (continuationsHolder == null)
+        if (continuationsHolder == null) {
             return null;
+        }
         
         WebContinuation kont = continuationsHolder.get(id);
-        if (kont == null)
+        if (kont == null) {
+            return null;            
+        }
+        
+        if (kont.hasExpired()) {
+            removeContinuation(continuationsHolder, kont);
             return null;
+        }
             
         if (!kont.interpreterMatches(interpreterId)) {
             getLogger().error(
@@ -229,6 +238,13 @@
                             + interpreterId);
             return null;
         }
+        
+        // COCOON-2109: Sorting in the TreeSet happens on insert. So in order to re-sort
the
+        //              continuation has to be re-added.
+        expirations.remove(kont);
+        kont.updateLastAccessTime();
+        expirations.add(kont);
+        
         return kont;
     }
 
@@ -579,7 +595,4 @@
         }
     }
 
-    public void contextualize(Context context) throws ContextException {
-        this.context = context;        
-    }
 }



Mime
View raw message