public static class SocketOptions.Builder extends Object
SocketOptions
.Modifier and Type | Method and Description |
---|---|
SocketOptions |
build()
Create a new instance of
SocketOptions |
SocketOptions.Builder |
connectTimeout(Duration connectTimeout)
Set connection timeout.
|
SocketOptions.Builder |
connectTimeout(long connectTimeout,
TimeUnit connectTimeoutUnit)
Deprecated.
since 5.0, use
connectTimeout(Duration) |
SocketOptions.Builder |
keepAlive(boolean keepAlive)
Set whether to enable TCP keepalive.
|
SocketOptions.Builder |
keepAlive(SocketOptions.KeepAliveOptions keepAlive)
Configure TCP keepalive.
|
SocketOptions.Builder |
tcpNoDelay(boolean tcpNoDelay)
Set whether to disable/enable Nagle's algorithm.
|
SocketOptions.Builder |
tcpUserTimeout(SocketOptions.TcpUserTimeoutOptions tcpUserTimeout)
Configure TCP User Timeout.
|
public SocketOptions.Builder connectTimeout(Duration connectTimeout)
SocketOptions.DEFAULT_CONNECT_TIMEOUT
and
SocketOptions.DEFAULT_CONNECT_TIMEOUT_UNIT
.connectTimeout
- connection timeout, must be greater 0.this
@Deprecated public SocketOptions.Builder connectTimeout(long connectTimeout, TimeUnit connectTimeoutUnit)
connectTimeout(Duration)
SocketOptions.DEFAULT_CONNECT_TIMEOUT
and
SocketOptions.DEFAULT_CONNECT_TIMEOUT_UNIT
.connectTimeout
- connection timeout, must be greater 0.connectTimeoutUnit
- unit for connectTimeout
, must not be null
.this
public SocketOptions.Builder keepAlive(boolean keepAlive)
false
. See SocketOptions.DEFAULT_SO_KEEPALIVE
.keepAlive
- whether to enable or disable the TCP keepalive.this
SocketOptions.SO_KEEPALIVE
public SocketOptions.Builder keepAlive(SocketOptions.KeepAliveOptions keepAlive)
SocketOptions.DEFAULT_SO_KEEPALIVE
.keepAlive
- whether to enable or disable the TCP keepalive.this
SocketOptions.KeepAliveOptions
,
SocketOptions.SO_KEEPALIVE
public SocketOptions.Builder tcpUserTimeout(SocketOptions.TcpUserTimeoutOptions tcpUserTimeout)
SocketOptions.DEFAULT_TCP_USER_TIMEOUT_ENABLED
.tcpUserTimeout
- the TCP User Timeout options.this
SocketOptions.TcpUserTimeoutOptions
public SocketOptions.Builder tcpNoDelay(boolean tcpNoDelay)
true
(Nagle disabled). See
SocketOptions.DEFAULT_SO_NO_DELAY
.
Disabling TCP NoDelay delays TCP ACK
packets to await more data input before confirming the packet.
tcpNoDelay
- false
to disable TCP NoDelay (enable Nagle's algorithm), true
to enable TCP NoDelay
(disable Nagle's algorithm).this
SocketOptions.TCP_NODELAY
public SocketOptions build()
SocketOptions
SocketOptions
Copyright © 2023 lettuce.io. All rights reserved.