jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: How are suspended responses usually managed?

From: Markus KARG <markus_at_headcrashing.eu>
Date: Fri, 12 Oct 2012 22:39:38 +0200

Yes this is one form of COMET. And: No, typically the browser will not keep
the connection open, since this only works if a really lot of constraints
*all* are fulfilled:
- The browser, the server, and all intermediate proxies must be http/1.1
compliant AND implement the persistent connection feature (which is optional
even in http/1.1), and all these systems must be bug-free.
- The browser, the server, and all intermediate proxies must intend to
actually use the persistent connection feature, as even a http/1.1 compliant
party that fulfils the above constraints in some situations might
intentionally prefer not to keep the connection open but instead close it
temporarily and restart another connection later (e. g. if the traffic on
the party is rather high, but the traffic on that push line is rather low),
which is a valid implementation of http, unless http/1.0 will be officially
"forbidden" (which typically will never happen).
- All of the participating parties must do both above issues at the same
time. If only one constraint is not fulfilled at any time, the connection
cannot kept open.

Example: You did your best efforts but for offloading reasons a Squid 3
proxy is installed -- which does not implement http/1.1 completely and
chances are high that it has lots of bugs... which foils the browser's and
server's best efforts.

You see, chances are very low that the connection actually is left open
(unfortunately).

Regards
Markus

> -----Original Message-----
> From: Jan Algermissen [mailto:jan.algermissen_at_nordsc.com]
> Sent: Freitag, 12. Oktober 2012 22:11
> To: jsr339-experts_at_jax-rs-spec.java.net
> Subject: [jsr339-experts] Re: How are suspended responses usually
> managed?
>
>
> On Oct 12, 2012, at 9:54 PM, Markus KARG wrote:
>
> > I'm rather sure you'll be very pleased by having a look at
> > AsyncResponse's JavaDocs (the code example in the class docs showing
> > how to implement COMET "pushing")... ;-)
>
> You mean the intro of
>
> http://jax-rs-spec.java.net/nonav/2.0-
> SNAPSHOT/apidocs/javax/ws/rs/container/AsyncResponse.html
>
> Is that Comet? Would the browser open a new connection after receiving
> the push?
>
>
> Jan
>
>
> >
> >> -----Original Message-----
> >> From: Jan Algermissen [mailto:jan.algermissen_at_nordsc.com]
> >> Sent: Freitag, 12. Oktober 2012 21:37
> >> To: jsr339-experts_at_jax-rs-spec.java.net
> >> Subject: [jsr339-experts] Re: How are suspended responses usually
> >> managed?
> >>
> >>
> >> On Oct 12, 2012, at 9:28 PM, Markus KARG wrote:
> >>
> >>> Jan,
> >>>
> >>> just scanned the public draft of the spec and did not find the word
> >>> "push" a single time! How did you come to the conclusion that the
> >>> async API will allow you to implement frequent server pushes ontop
> >>> of
> >> it?
> >>
> >> I thought that was one of the motivations behind it and Bill
> mentions
> >> it as one in his Oct 9th talk on Infoq.
> >>
> >>
> >>
> >> Jan
> >>
> >>
> >>>
> >>> Regards
> >>> Markus
> >>>
> >>>> -----Original Message-----
> >>>> From: Jan Algermissen [mailto:jan.algermissen_at_nordsc.com]
> >>>> Sent: Freitag, 12. Oktober 2012 16:11
> >>>> To: jsr339-experts_at_jax-rs-spec.java.net
> >>>> Subject: [jsr339-experts] Re: How are suspended responses usually
> >>>> managed?
> >>>>
> >>>>
> >>>> On Oct 12, 2012, at 3:49 PM, Bill Burke wrote:
> >>>>
> >>>>>
> >>>>>
> >>>>> On 10/12/2012 9:38 AM, Jan Algermissen wrote:
> >>>>>> Hi
> >>>>>>
> >>>>>> when a response is suspended by the async API the request
> handing
> >>>> thread is being 'released from duty' and can continue serving
> >> requests.
> >>>>>>
> >>>>>> So far I understand. What I am not entirely clear about is what
> >>>> happens with the suspended response - will these be 'parked' in an
> >>>> extra thread? Or will there be one thread for each suspended
> >> response?
> >>>>>>
> >>>>>
> >>>>> Its up to you and your application. That's the idea.
> >>>>
> >>>> Ok, yes.
> >>>>
> >>>> Sorry for being stupid.. but:
> >>>>
> >>>> - so when I suspend a response without invoking a new thread
> >>>> nothing happens except that a connection is being used (meaning
> >>>> that a
> >> queue
> >>>> of 1000 responses would use up 1000
> >>>> connections)
> >>>>
> >>>> - when I resume the response, the response will be sent in the
> >>>> current thread of execution.
> >>>>
> >>>> That's simple, but I find the implications not so easy to see at
> >> first.
> >>>> Thanks.
> >>>>
> >>>>
> >>>> What I would love to be able to do is to suspend/resume again.
> >>>> Considering server push, it seems odd that I can have a long
> >>>> running request without resource consumption *until* the first
> bits
> >>>> of the response are sent. What if I want to send one event every
> Minute?
> >> The
> >>>> initial async doesn't really buy me that much, does it?
> >>>>
> >>>> (just trying to get my head straight)
> >>>>
> >>>> Jan
> >>>>
> >>>>
> >>>>
> >>>>>
> >>>>> --
> >>>>> Bill Burke
> >>>>> JBoss, a division of Red Hat
> >>>>> http://bill.burkecentral.com
> >>>
> >>>
> >
> >