cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <...@apache.org>
Subject Re: Continuations and cleaning up
Date Thu, 04 Nov 2004 13:01:33 GMT
Il giorno 04/nov/04, alle 11:28, Smith, Lee [OS-IE] ha scritto:

>  3:    var myDB = Database.getConnection("myPool");
>  4:    myDB.setAutoCommit(false);
>  5:
>  6:    .. do some work on the connection, don't commit
>  7:
>  8:    cocoon.sendPageAndWait("confirm_changes.html");
>  9:
> 10:    if (cocoon.request.getParameter("confirm_changes") == "true")
> 11:       myDB.commit();
> 12:    else
> 13:       myDB.rollback();
> 14:
> 15:    cocoon.sendPage("change_made.html");
> 14: }

You should *NEVER* have transactions whose lifetime includes users' 
think time. You're just asking for trouble by doing this. There is no 
way to guarantee that the commit/rollback code will be called in a 
reasonable amount of time.

This is not a problem with Coocon's use of continuations, but is 
typical of all web apps. With flowscript it's just easier to fall in 
this trap.

Search Google for "optimistic lock". This is also a good starting 
point: 
http://www.martinfowler.com/eaaCatalog/optimisticOfflineLock.html

	Ugo


-- 
Ugo Cei - http://beblogging.com/

Mime
View raw message