[Seaside] Session. Where to put DB connect/disconnect code.

Avi Bryant avi.bryant at gmail.com
Sun Mar 6 20:10:12 CET 2005


On Sun, 6 Mar 2005 10:55:10 -0600, Wilkes Joiner <wilkesjoiner at gmail.com> wrote:
> Can someone shed some light on the code below?  My impression is that
> it commit any changes you've made during the request cycle before
> sending the response.  Is that accurate?

Yes, it is.  The "withRetry" bit also means that if there is a commit
conflict, the entire request will be restarted from the beginning
(possibly several times before a response is ever returned).

To elaborate a bit more: #withEscapeContinuation: is the point that
control flow returns to when the request processing is done and the
application wishes to return a response.  The value passed *to*
WASession>>returnResponse: will be returned *from*
WASession>>withEscapeContinuation:.  So the point of intercepting the
flow here to do the transaction is that you know that you've escaped
out of all the messy continuation stuff, and that the application is
totally done with any processing it's going to do with the request. 
Unlike in most places in Seaside, you can be guaranteed that this
method will be called exactly once, and return exactly once, for each
HTTP request :).
 
> On Mar 2, 2005, at 6:40 AM, Dmitry Dorofeev wrote:
> > Example in the doc says
> > withEscapeContinuation: aBlock
> >   ^ (self db) commitWithRetry: [super withEscapeContinuation: aBlock]


More information about the Seaside mailing list