JEP 110 HTTP 2 client API

Kasper Nielsen kasperni at gmail.com
Fri Apr 10 11:32:05 UTC 2015


On Fri, Apr 3, 2015 at 3:20 PM, Pavel Rappo <pavel.rappo at oracle.com> wrote:

> Hi Kasper,
>
> I assume your questions are all about WebSocket part, right? If so, then
>
> > 1)
> > Would it possible to add a connect timeout parameter.
> > builder.setConnectTimeout(long timeout, TimeUnit unit)
> >
> > For some reason it was left out of the javax.websocket API. And working
> > around it is a serious PITA.
>
> What's the purpose of this timeout? Could you please explain it a bit more?
>
> It is pretty normal to not want to block indefinitely on I/O methods.
For example, in java.net.Socket you have both
connect(SocketAddress endpoint)
connect(SocketAddress endpoint, int timeout)

the way I work around it in the javax.websocket api. Is spawning a thread
that can interrupt the blocking thread after XX seconds.
But that is pretty annoying.


> > 4)
> > I find the use of byte[] vs ByteBuffer a bit inconsistent.
> > For example, HttpResponseBodyProcessor uses ByteBuffer while
> > WebSocketMessage uses byte[]
>
> I believe this is done solely for simplicity. HttpClient is a more "general
> purpose" kind of thing.


 I'm not sure I understand what you mean here. ByteBuffer is for general
purpose things.
While byte[] is for special things? I would say it was the other way
around.



More information about the core-libs-dev mailing list