tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: HTTP/2 PushBuilder.push() synchronous?
Date Thu, 29 Sep 2016 16:16:49 GMT
On 29 September 2016 15:30:40 BST, Brian Clozel <bclozel@pivotal.io> wrote:
>Hi,
>
>Looking at previous Servlet 4.0 EG e-mails [1] and the
>PushBuilder.push()
>API [2], it seems the current version returns true if the PUSH_PROMISE
>frame + headers were sent, meaning the client can still reset that
>stream
>and refuse to receive the response that goes with it.

Not quite. It returns true if the push is accepted by the server. I'm on my phone so looking
at the code is tricky. I can't remember if an error triggers an exception or returns false.

>Now looking at former EG e-mails, it seems that a previous version of
>the
>spec stated that push "returns immediately without blocking" [3]. But
>this
>API, and the implementation as far as I understand things [4], seems
>synchronous. Or does that writing does not happen directly on the
>actual
>socket but is later dispatched on another thread?

The push is built on the current thread and then passed to a separate thread for processing.
The idea being to catch as many errors as possible on the current thread.

The client is free to reset the pushed steam at any point. 

HTH,

Mark


>In general, I'm trying to understand how I can use that API in an
>async,
>non-blocking way and if the application really needs to know if the
>Push
>promise "happened" or not...
>
>Cheers,
>
>[1] https://java.net/projects/servlet-spec/lists/jsr369-
>experts/archive/2016-03/message/0
>[2] https://github.com/apache/tomcat/blob/trunk/java/javax/s
>ervlet/http/PushBuilder.java#L161-L178
>[3] https://java.net/projects/servlet-spec/lists/jsr369-expe
>rts/archive/2015-12/message/8
>[4] https://github.com/apache/tomcat/blob/trunk/java/org/apa
>che/coyote/http2/Http2UpgradeHandler.java#L1036
>--
>Brian Clozel



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message