![](/img/trans.png)
[英]How to increase timeout while making a REST call from a Java jersey client?
[英]how to increase jersey WS timeout
如何增加球衣WS超时? 它正在等待大约2分钟的电话。 它在WS层超时。 我是否还必须增加客户端超时? 这些的默认值是什么?
您可以在Client
实例上使用setConnectTimeOut
和setReadTimeout
这两种方法。 该文档指定两者的默认值为null
,因此超时无限。
确保根据应用程序的需要设置setReadTimeout ,因为设置连接超时将是部分完成工作。
我们可以使用ClientProperties.CONNECT_TIMEOUT
和ClientProperties.READ_TIMEOUT
属性。
示例:
ClientConfig configuration = new ClientConfig();
configuration.property(ClientProperties.CONNECT_TIMEOUT, 1000);
configuration.property(ClientProperties.READ_TIMEOUT, 1000);
Client client = ClientBuilder.newClient(configuration);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.