On Mon, Apr 20, 2015 at 5:54 AM, George Neuner <gneun...@comcast.net> wrote:
> Hi David,
>
> On 4/19/2015 9:51 AM, David Vanderson wrote:
>
> On 04/18/2015 12:34 PM, George Neuner wrote:
>
> However, to do this, I have to keep the initial id list across multiple
> requests and that is where I've run into trouble.  Thus far, I haven't had
> to use web server continuations.  It seems like send/suspend does not allow
> the browser to provide additional arguments (like paging direction).
>
> The trick with using the continuations is you don't pass any arguments
> through the url.  All information is stored in local variables that are
> captured automatically by the continuation.  The url will be generated for
> you, it just points to a continuation stored on the server.  Does that make
> sense?  It's hard to wrap your brain around at first.
>
>
> I understand continuations in Scheme - it's the mechanism of this
> URL/dispatch that I'm having a slight problem with.  (see below)
>
>
>   send/suspend/dispatch looks like it will do what I want, however I need to
> communicate the URLs to the browser in JSON and it (superficially) appears
> as if  embed/url is meant to work in generated HTML?
>
> You need to use a different response function.  See the attached code for an
> example.  Look at the docs for 'response/xexpr' to see what it does.
>
>
> I know I need a different response function.  The question was whether
> embed/url  is tied to HTML or can be used in a different context.  The
> documentation (6.1.1) says:
>
>     "When used inside page syntactically, a rename transformer for the
> procedure embedding function; otherwise, a syntax error."
>
> That suggests  embed/url  can be used only in (X)HTML responses and that I
> need to use something else to create dispatch URLs in regular code.
>
>
> The final problem is how to ensure that I eventually get to send/finish and
> clean up my thread.  This particular function is expected to be executed
> quite often.  Does the browser app have to invoke a URL that deliberately
> ends the thread or will the thread end if/when its continuations time out?
>
> What do you need to clean up?  To be clear, there isn't a thread that keeps
> running - the continuation is just some data, and like Jay said, it will
> eventually be cleaned up.  If you want to remove the continuations manually,
> call send/forward or send/finish.  See the attached code.  In particular,
> try running it, and then copying the url to a second browser window.  You'll
> see how two users have different continuations.
>
>
> My understanding is that serve/servlet executes dispatched functions in
> separate threads.  And I do see server multi-threading in practice - e.g., a
> quick sequence of XHR calls made by the browser finishing in different
> order.  Timestamped in my application log as well as seen at the browser.
>
> So when I send/suspend* there will be a thread left suspended.  Will that
> thread context be cleaned up if the continuation expires?   And can I get a
> notification of which thread is involved?  Or better yet, get the thread
> restarted at yet another point so I can log that it has finished processing.
> Are the threads just nuked invisibly or are they terminated by an exception
> that I can catch?
>

Threads are never left running, but multiple threads are used to
handle the request stream.

Jay

> George
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to