java.lang.Object
io.lettuce.core.SocketOptions.Builder
- Enclosing class:
- SocketOptions
public static class SocketOptions.Builder extends Object
Builder for
SocketOptions.-
Method Summary
Modifier and Type Method Description SocketOptionsbuild()Create a new instance ofSocketOptionsSocketOptions.BuilderconnectTimeout(long connectTimeout, TimeUnit connectTimeoutUnit)Deprecated.SocketOptions.BuilderconnectTimeout(Duration connectTimeout)Set connection timeout.SocketOptions.BuilderkeepAlive(boolean keepAlive)Set whether to enable TCP keepalive.SocketOptions.BuilderkeepAlive(SocketOptions.KeepAliveOptions keepAlive)Configure TCP keepalive.SocketOptions.BuildertcpNoDelay(boolean tcpNoDelay)Set whether to disable/enable Nagle's algorithm.
-
Method Details
-
connectTimeout
Set connection timeout. Defaults to 10 SECONDS. SeeSocketOptions.DEFAULT_CONNECT_TIMEOUTandSocketOptions.DEFAULT_CONNECT_TIMEOUT_UNIT.- Parameters:
connectTimeout- connection timeout, must be greater 0.- Returns:
this- Since:
- 5.0
-
connectTimeout
@Deprecated public SocketOptions.Builder connectTimeout(long connectTimeout, TimeUnit connectTimeoutUnit)Deprecated.since 5.0, useconnectTimeout(Duration)Set connection timeout. Defaults to 10 SECONDS. SeeSocketOptions.DEFAULT_CONNECT_TIMEOUTandSocketOptions.DEFAULT_CONNECT_TIMEOUT_UNIT.- Parameters:
connectTimeout- connection timeout, must be greater 0.connectTimeoutUnit- unit forconnectTimeout, must not benull.- Returns:
this
-
keepAlive
Set whether to enable TCP keepalive. Defaults tofalse. SeeSocketOptions.DEFAULT_SO_KEEPALIVE.- Parameters:
keepAlive- whether to enable or disable the TCP keepalive.- Returns:
this- See Also:
SocketOptions.SO_KEEPALIVE
-
keepAlive
Configure TCP keepalive. Defaults to disabled. SeeSocketOptions.DEFAULT_SO_KEEPALIVE.- Parameters:
keepAlive- whether to enable or disable the TCP keepalive.- Returns:
this- Since:
- 6.1
- See Also:
SocketOptions.KeepAliveOptions,SocketOptions.SO_KEEPALIVE
-
tcpNoDelay
Set whether to disable/enable Nagle's algorithm. Defaults totrue(Nagle disabled). SeeSocketOptions.DEFAULT_SO_NO_DELAY.Disabling TCP NoDelay delays TCP
ACKpackets to await more data input before confirming the packet.- Parameters:
tcpNoDelay-falseto disable TCP NoDelay (enable Nagle's algorithm),trueto enable TCP NoDelay (disable Nagle's algorithm).- Returns:
this- See Also:
SocketOptions.TCP_NODELAY
-
build
Create a new instance ofSocketOptions- Returns:
- new instance of
SocketOptions
-
connectTimeout(Duration)