JEP 110 HTTP 2 client API

Pavel Rappo pavel.rappo at oracle.com
Fri Apr 3 13:20:12 UTC 2015


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?

> 2)
> Rename Websocket to WebsocketClient to avoid people thinking you can use it
> server side?

Makes sense.
I would also change following methods' names:

	java.net.WebSocket#create(java.net.URI)
	java.net.WebSocket#create(java.net.HttpClient, java.net.URI)

as they create a _builder_, not a WebSocket, which a bit misleading in my
opinion.

> 3)
> How is the threading done for something like asynchronous connect?

Let's wait for Michael to reply. But I suppose it'll be a non-blocking
selector-based nio thing running by worker threads from

    java.net.HttpClient#executorService 

(I might be mistaken)

> 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.

-Pavel



More information about the core-libs-dev mailing list