[
https://issues.apache.org/jira/browse/COCOON-2109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519021
]
mcuervoe edited comment on COCOON-2109 at 8/12/07 1:22 AM:
----------------------------------------------------------------
Jorg,
Just a small test to prove that the ordering is happening on insert
--------------------------
package test;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
public class Test implements Comparable {
public int i;
public Test(int x) {
i = x;
}
public int compareTo(Object o) {
Test obj = (Test) o;
return i - obj.i;
}
public static void main(String[] args) {
SortedSet set = new TreeSet();
Test obj1 = new Test(1);
set.add(obj1);
Test obj2 = new Test(3);
set.add(obj2);
Test obj3 = new Test(2);
set.add(obj3);
Iterator iter = set.iterator();
System.out.println("Should print 1,2,3");
while (iter.hasNext()) {
Test obj = (Test) iter.next();
System.out.println(obj.i);
}
obj3.i = 4;
System.out.println("Order modified after insetion");
System.out.println("Should print 1,3,4");
iter = set.iterator();
while (iter.hasNext()) {
Test obj = (Test) iter.next();
System.out.println(obj.i);
}
System.out.println("...but it prints 1,4,3 keeping the order in
which the object was inserted");
}
}
was (Author: mcuervoe):
Jorg,
Just a small test to prove that the insertion is happening on insert
--------------------------
package test;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
public class Test implements Comparable {
public int i;
public Test(int x) {
i = x;
}
public int compareTo(Object o) {
Test obj = (Test) o;
return i - obj.i;
}
public static void main(String[] args) {
SortedSet set = new TreeSet();
Test obj1 = new Test(1);
set.add(obj1);
Test obj2 = new Test(3);
set.add(obj2);
Test obj3 = new Test(2);
set.add(obj3);
Iterator iter = set.iterator();
System.out.println("Should print 1,2,3");
while (iter.hasNext()) {
Test obj = (Test) iter.next();
System.out.println(obj.i);
}
obj3.i = 4;
System.out.println("Order modified after insetion");
System.out.println("Should print 1,3,4");
iter = set.iterator();
while (iter.hasNext()) {
Test obj = (Test) iter.next();
System.out.println(obj.i);
}
System.out.println("...but it prints 1,4,3 keeping the order in
which the object was inserted");
}
}
> Incorrent cleanup of expired continuations
> ------------------------------------------
>
> Key: COCOON-2109
> URL: https://issues.apache.org/jira/browse/COCOON-2109
> Project: Cocoon
> Issue Type: Bug
> Components: - Flowscript
> Affects Versions: 2.1.6, 2.1.7, 2.1.8, 2.1.9, 2.1.10, 2.1.11-dev (Current
> SVN)
> Reporter: Miguel Cuervo
> Attachments: ContinuationsManagerImpl.java.patch
>
>
> The class ContinuationsManagerImpl is in charge of cleaning up expired
> continuations. It does so in the method expireContinuations. In this method
> there is a loop using an iterator over a SortedSet of continuations
> (WebContinuation). The loop is expecting that the continuations are ordered
> from oldest to newest. The loop stops in the first continuation that is not
> expired. The logic is correct since all the newer continuations could not be
> expired.
> However, the problem comes from the ordering of the continuations. To have
> the continuations ordered by lastAccessTime the program uses a TreeSet as a
> container of the continuations. The continuations implement the compareTo
> interface using the lastAccessTime and when a continuation is inserted in the
> container, it gets correctly ordered. But after the insertion, the
> continuation can change its lastAccessTime using the method
> WebContinuation.updateLastAccessTime() called from
> WebContinuation.getContinuation(). The ordering of the TreeSet is not updated
> with the change and when the program iterates over it, it does not get the
> continuations in the order expected.
> The result of this bug is that under hevy load many expired continuations may
> be around before the loop actually clean them up, eating memory resources and
> causing OutOfMemory.
> To fix it, a patch is provided that uses a HashSet for the continuations
> container and loops over all the continuations to check if they have expired.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.