Skip to content

Commit 7ca39e3

Browse files
authored
IGNITE-28442 [Java Thin Client] Introduced default values for handshake and request timeouts (#12993)
1 parent d35cb63 commit 7ca39e3

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

modules/core/src/main/java/org/apache/ignite/configuration/ClientConfiguration.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public final class ClientConfiguration implements Serializable {
4949
/** Serial version uid. */
5050
private static final long serialVersionUID = 0L;
5151

52+
/** Default connection/handshake timeout in milliseconds. */
53+
private static final int DFLT_HANDSHAKE_TIMEOUT = 10_000;
54+
55+
/** Default operation request timeout in milliseconds. */
56+
private static final int DFLT_REQUEST_TIMEOUT = 60_000;
57+
5258
/** @serial Server addresses. */
5359
private String[] addrs;
5460

@@ -58,11 +64,11 @@ public final class ClientConfiguration implements Serializable {
5864
/** @serial Tcp no delay. */
5965
private boolean tcpNoDelay = true;
6066

61-
/** @serial Handshake timeout in milliseconds. 0 means infinite. */
62-
private int handshakeTimeout;
67+
/** @serial Handshake timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout. */
68+
private int handshakeTimeout = DFLT_HANDSHAKE_TIMEOUT;
6369

64-
/** @serial Request timeout in milliseconds. 0 means infinite. */
65-
private int reqTimeout;
70+
/** @serial Request timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout. */
71+
private int reqTimeout = DFLT_REQUEST_TIMEOUT;
6672

6773
/** @serial Send buffer size. 0 means system default. */
6874
private int sndBufSize = 32 * 1024;
@@ -261,14 +267,16 @@ public ClientConfiguration setTimeout(int timeout) {
261267
}
262268

263269
/**
264-
* @return Handshake timeout in milliseconds. 0 means infinite.
270+
* @return Handshake timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout.
271+
* By default, the timeout value is set to {@link #DFLT_HANDSHAKE_TIMEOUT}.
265272
*/
266273
public int getHandshakeTimeout() {
267274
return handshakeTimeout;
268275
}
269276

270277
/**
271-
* @param handshakeTimeout Handshake timeout in milliseconds. 0 means infinite.
278+
* @param handshakeTimeout Handshake timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout.
279+
* By default, the timeout value is set to {@link #DFLT_HANDSHAKE_TIMEOUT}.
272280
* @return {@code this} for chaining.
273281
*/
274282
public ClientConfiguration setHandshakeTimeout(int handshakeTimeout) {
@@ -278,14 +286,16 @@ public ClientConfiguration setHandshakeTimeout(int handshakeTimeout) {
278286
}
279287

280288
/**
281-
* @return Request timeout in milliseconds. 0 means infinite.
289+
* @return Request timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout.
290+
* By default, the timeout value is set to {@link #DFLT_REQUEST_TIMEOUT}.
282291
*/
283292
public int getRequestTimeout() {
284293
return reqTimeout;
285294
}
286295

287296
/**
288-
* @param reqTimeout Request timeout in milliseconds. 0 means infinite.
297+
* @param reqTimeout Request timeout in milliseconds. A timeout of zero is interpreted as an infinite timeout.
298+
* By default, the timeout value is set to {@link #DFLT_REQUEST_TIMEOUT}.
289299
* @return {@code this} for chaining.
290300
*/
291301
public ClientConfiguration setRequestTimeout(int reqTimeout) {

0 commit comments

Comments
 (0)