Package io.lettuce.core
Class SocketOptions.KeepAliveOptions.Builder
- java.lang.Object
-
- io.lettuce.core.SocketOptions.KeepAliveOptions.Builder
-
- Enclosing class:
- SocketOptions.KeepAliveOptions
public static class SocketOptions.KeepAliveOptions.Builder extends Object
Builder forSocketOptions.KeepAliveOptions
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketOptions.KeepAliveOptions
build()
Create a new instance ofSocketOptions.KeepAliveOptions
SocketOptions.KeepAliveOptions.Builder
count(int count)
Set the maximum number of keepalive probes TCP should send before dropping the connection.SocketOptions.KeepAliveOptions.Builder
disable()
Disable TCP keepalive.SocketOptions.KeepAliveOptions.Builder
enable()
Enable TCP keepalive.SocketOptions.KeepAliveOptions.Builder
enable(boolean enabled)
Enable TCP keepalive.SocketOptions.KeepAliveOptions.Builder
idle(Duration idle)
The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled.SocketOptions.KeepAliveOptions.Builder
interval(Duration interval)
The time between individual keepalive probes.
-
-
-
Method Detail
-
count
public SocketOptions.KeepAliveOptions.Builder count(int count)
Set the maximum number of keepalive probes TCP should send before dropping the connection. Defaults to9
. See alsoSocketOptions.KeepAliveOptions.DEFAULT_COUNT
andTCP_KEEPCNT
.- Parameters:
count
- the maximum number of keepalive probes TCP- Returns:
this
-
enable
public SocketOptions.KeepAliveOptions.Builder enable()
Enable TCP keepalive. Defaults to disabled. SeeSocketOptions.DEFAULT_SO_KEEPALIVE
.- Returns:
this
- See Also:
SocketOptions.SO_KEEPALIVE
-
disable
public SocketOptions.KeepAliveOptions.Builder disable()
Disable TCP keepalive. Defaults to disabled. SeeSocketOptions.DEFAULT_SO_KEEPALIVE
.- Returns:
this
- See Also:
SocketOptions.SO_KEEPALIVE
-
enable
public SocketOptions.KeepAliveOptions.Builder enable(boolean enabled)
Enable TCP keepalive. Defaults tofalse
. SeeSocketOptions.DEFAULT_SO_KEEPALIVE
.- Parameters:
enabled
- whether to enable TCP keepalive.- Returns:
this
- See Also:
SocketOptions.SO_KEEPALIVE
-
idle
public SocketOptions.KeepAliveOptions.Builder idle(Duration idle)
The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled. Defaults to2 hours
. See also @linkSocketOptions.KeepAliveOptions.DEFAULT_IDLE
andTCP_KEEPIDLE
.The time granularity of is seconds.
- Parameters:
idle
- connection idle time, must be greater 0.- Returns:
this
-
interval
public SocketOptions.KeepAliveOptions.Builder interval(Duration interval)
The time between individual keepalive probes. Defaults to75 second
. See alsoSocketOptions.KeepAliveOptions.DEFAULT_INTERVAL
andTCP_KEEPINTVL
.The time granularity of is seconds.
- Parameters:
interval
- connection interval time, must be greater 0- Returns:
this
-
build
public SocketOptions.KeepAliveOptions build()
Create a new instance ofSocketOptions.KeepAliveOptions
- Returns:
- new instance of
SocketOptions.KeepAliveOptions
-
-