MyYyY
MyYyY

Reputation: 61

Jetty HTTP/2: How to set client session timeout?

I'm trying to create one session and reuse it for every request. The problem is if I try to send a request after 30 seconds after the session was createad, I get:

Caused by: java.nio.channels.ClosedChannelException
at  org.eclipse.jetty.http2.HTTP2Session$ControlEntry.succeeded
(HTTP2Session.java:1224) ~[http2-common-9.4.0.v20161208.jar:9.4.0.v20161208]

I tried like this

   SSLSessionContext clientSessionContext = sslContextFactory.getSslContext().getClientSessionContext();
  clientSessionContext.setSessionTimeout(60000);

but it doesen't seems to work

Upvotes: 2

Views: 3120

Answers (1)

sbordet
sbordet

Reputation: 18487

If you are using HttpClient, the client idle timeout can be set with HttpClient.setIdleTimeout(long).

If you are using the low-level HTTP2Client, the client idle timeout can be set with HTTP2Client.setIdleTimeout(long).

Both will control the connection/session idle timeout, which is apparently what you want. A negative value will disable the idle timeout.

Upvotes: 4

Related Questions