cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: Expire Continuations
Date Tue, 03 Dec 2002 06:38:33 GMT
Hi Michael,

OK, I'm back from a longer absence due to the Thanksgiving vacation.

On Thursday, Nov 28, 2002, at 10:28 US/Pacific, Michael Melhem wrote:

> Hi Ovidiu!!
>
> How are you mate, I guess you are not coming to the Frankfurt
> Stammtisch???? :-P

Wait a second, I want to come! ;)

> I was thinking about how to Expire Continuations and have come up with
> the following:
>
> We know from the "bus discussion" that placing every wk 
> (WebContinuation)
> into the "expirations" Sorted TreeSet is a problematic solution. So how
> about placing only the "leaf" nodes in this set for each tree?

The bus discussion should be placed in the references section of the 
documentation and in the comments in the source code ;)

> This can be done by:
>     for each new wk
>     	(if wk.getparent().numChildren() < 2)
> 		expirations.remove(wk.getparent());
> 	expirations.add(wk);
>
> This could be an expensive operation especially if the set of wk's is
> very large .... although.. the treeSet guarantees log(n) time cost for
> basic operations. What do you think ?
>
> Given that we have a sorted set of "leaf" nodes (from all continuation
> trees) we need to excute the following algorithm to rid the
> system of expired wk's
>
> 	For each leaf node in the set which is expired:
> 		delete it, and
> 		recursively delete its parent
> 		only if its parent has also expired
> 		*and* has no (other) children.
>
> We could make the ContinuationsManager an avlaon monitored Resource,
> so that we can periodically trigger continuations clean ups.
>
> 	This implies the max life of an "wk" after lastAcceesTime
> 	equals timeToLive + cleanUp_period.
>
>
> What do you think??

I think the TreeSet is definitely the way to go, as it is a sorted 
collection and accesses and removals from it are very fast.

One observation related to your algorithm, which is an idea I had when 
we got off The Bus, is that we don't need to handle children 
continuations of a given continuation. This is because each and every 
continuation will appear in the sorted tree, and we can expire 
individual continuations separate from their children. This is 
different than the ContinuationManagerImpl.invalidateWebContinuation() 
method which invalidates the whole subtree of continuations. We could 
add a similar method which removes only the continuation passed to it 
as argument, without recursively removing the whole continuation 
subtree.

The expiration algorithm will then simply iterate over the tree set 
until a continuation whose access time + expiration time is greater 
than the current time. All the continuations encountered before that 
are simply removed from the global hash set.

What do you think?

Ovidiu


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


Mime
View raw message