[e-lang] Re: Observation with timeout

Kevin Reid kpreid at attglobal.net
Mon Dec 27 10:58:01 EST 2004


On Dec 27, 2004, at 4:43, Michael Sperber wrote:

>>>>>> "Kevin" == Kevin Reid <kpreid at attglobal.net> writes:
>
> Kevin> On Dec 16, 2004, at 13:40, Michael Sperber wrote:
>
>>> Let's say, the client is a web server that's talking to some database
>>> that gives out locks to some data.  The client tries to answer the
>>> request and therefore tries to obtain the lock.  However, it wants to
>>> send back a meaningful message in case it can't obtain the lock 
>>> within
>>> a timeout period.
>
>
> Kevin> def makeRevoker := <import:org.erights.e.facet.makeRevoker>
> Kevin> def dbLock := makeLock()
>
> Kevin> [...]
>
> Many thanks!
>
> Could you provide a usage example for this?  I'm still having some
> trouble getting my fingernails on E code samples as large as this
> one.  Specifically, what's the role of the "handler"?

"handler" would, I assumed, be invoked by the web server, it being a 
request handler (analogous to CGI/ASP/etc.).

webServer.addHandler("/db/query", handler)   # or whatever ...

The server would invoke it in some way similar to (but most likely more 
complex than)

   def handler := lookup(request.getPath())

   httpWriter <- body(handler <- handle(request))


-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>



More information about the e-lang mailing list