开发者

how to increase jersey WS timeout

开发者 https://www.devze.com 2023-01-23 03:00 出处:网络
How do I increase the jersey WS timeout? It is waiting on a call which takes around 2 minutes. It is timing out at WS layer. Do I have to increase client timeout as we开发者_如何学Goll? What are the

How do I increase the jersey WS timeout? It is waiting on a call which takes around 2 minutes. It is timing out at WS layer. Do I have to increase client timeout as we开发者_如何学Goll? What are the defaults for these?


You can use the two methods setConnectTimeOut and the setReadTimeout on your Client instance. The documentation specifies that the default values for both are null and thus the timeouts infinite.


Do make sure to set the setReadTimeout as per the need of your application as setting connection timeout would be partial job done.


We can use ClientProperties.CONNECT_TIMEOUT and ClientProperties.READ_TIMEOUT property.

Example :

ClientConfig configuration = new ClientConfig();
configuration.property(ClientProperties.CONNECT_TIMEOUT, 1000);
configuration.property(ClientProperties.READ_TIMEOUT, 1000);

Client client = ClientBuilder.newClient(configuration);
0

精彩评论

暂无评论...
验证码 换一张
取 消