public static class SocketOptions.KeepAliveOptions.Builder extends Object
SocketOptions.KeepAliveOptions
.Modifier and Type | Method and Description |
---|---|
SocketOptions.KeepAliveOptions |
build()
Create a new instance of
SocketOptions.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.
|
public SocketOptions.KeepAliveOptions.Builder count(int count)
9
.
See also SocketOptions.KeepAliveOptions.DEFAULT_COUNT
and TCP_KEEPCNT
.count
- the maximum number of keepalive probes TCPthis
public SocketOptions.KeepAliveOptions.Builder enable()
SocketOptions.DEFAULT_SO_KEEPALIVE
.this
SocketOptions.SO_KEEPALIVE
public SocketOptions.KeepAliveOptions.Builder disable()
SocketOptions.DEFAULT_SO_KEEPALIVE
.this
SocketOptions.SO_KEEPALIVE
public SocketOptions.KeepAliveOptions.Builder enable(boolean enabled)
false
. See SocketOptions.DEFAULT_SO_KEEPALIVE
.enabled
- whether to enable TCP keepalive.this
SocketOptions.SO_KEEPALIVE
public SocketOptions.KeepAliveOptions.Builder idle(Duration idle)
2 hours
. See also @link SocketOptions.KeepAliveOptions.DEFAULT_IDLE
and TCP_KEEPIDLE
.
The time granularity of is seconds.
idle
- connection idle time, must be greater 0.this
public SocketOptions.KeepAliveOptions.Builder interval(Duration interval)
75 second
. See also SocketOptions.KeepAliveOptions.DEFAULT_INTERVAL
and TCP_KEEPINTVL
.
The time granularity of is seconds.
interval
- connection interval time, must be greater 0this
public SocketOptions.KeepAliveOptions build()
SocketOptions.KeepAliveOptions
SocketOptions.KeepAliveOptions
Copyright © 2025 lettuce.io. All rights reserved.