Package io.lettuce.core
Class SocketOptions.KeepAliveOptions
- java.lang.Object
-
- io.lettuce.core.SocketOptions.KeepAliveOptions
-
- Enclosing class:
- SocketOptions
public static class SocketOptions.KeepAliveOptions extends Object
Extended Keep-Alive options (idle, interval, count). Extended options should not be used in code intended to be portable as options are applied only when using NIO sockets with Java 11 or newer epoll sockets, or io_uring sockets. Not applicable for kqueue in general or NIO sockets using Java 10 or earlier.The time granularity of
getIdle()
andgetInterval()
is seconds.- Since:
- 6.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SocketOptions.KeepAliveOptions.Builder
Builder forSocketOptions.KeepAliveOptions
.
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_COUNT
static Duration
DEFAULT_IDLE
static Duration
DEFAULT_INTERVAL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SocketOptions.KeepAliveOptions.Builder
builder()
Returns a newSocketOptions.KeepAliveOptions.Builder
to constructSocketOptions.KeepAliveOptions
.int
getCount()
Returns the maximum number of keepalive probes TCP should send before dropping the connection.Duration
getIdle()
The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled.Duration
getInterval()
The time between individual keepalive probes.boolean
isEnabled()
Returns whether to enable TCP keepalive.SocketOptions.KeepAliveOptions.Builder
mutate()
Returns a builder to create newSocketOptions.KeepAliveOptions
whose settings are replicated from the currentSocketOptions.KeepAliveOptions
.
-
-
-
Field Detail
-
DEFAULT_COUNT
public static final int DEFAULT_COUNT
- See Also:
- Constant Field Values
-
DEFAULT_IDLE
public static final Duration DEFAULT_IDLE
-
DEFAULT_INTERVAL
public static final Duration DEFAULT_INTERVAL
-
-
Method Detail
-
builder
public static SocketOptions.KeepAliveOptions.Builder builder()
Returns a newSocketOptions.KeepAliveOptions.Builder
to constructSocketOptions.KeepAliveOptions
.- Returns:
- a new
SocketOptions.KeepAliveOptions.Builder
to constructSocketOptions.KeepAliveOptions
.
-
mutate
public SocketOptions.KeepAliveOptions.Builder mutate()
Returns a builder to create newSocketOptions.KeepAliveOptions
whose settings are replicated from the currentSocketOptions.KeepAliveOptions
.- Returns:
- a
SocketOptions.KeepAliveOptions.Builder
to create newSocketOptions.KeepAliveOptions
whose settings are replicated from the currentSocketOptions.KeepAliveOptions
-
getCount
public int getCount()
Returns the maximum number of keepalive probes TCP should send before dropping the connection. Defaults to9
. See alsoDEFAULT_COUNT
andTCP_KEEPCNT
.- Returns:
- the maximum number of keepalive probes TCP should send before dropping the connection.
-
isEnabled
public boolean isEnabled()
Returns whether to enable TCP keepalive.- Returns:
- whether to enable TCP keepalive
- See Also:
SocketOptions.SO_KEEPALIVE
-
getIdle
public Duration getIdle()
The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled. Defaults to2 hours
. See also @linkDEFAULT_IDLE
andTCP_KEEPIDLE
.The time granularity of is seconds.
- Returns:
- the time the connection needs to remain idle before TCP starts sending keepalive probes.
-
getInterval
public Duration getInterval()
The time between individual keepalive probes. Defaults to1 second
. See alsoDEFAULT_INTERVAL
andTCP_KEEPINTVL
.The time granularity of is seconds.
- Returns:
- the time the connection needs to remain idle before TCP starts sending keepalive probes.
-
-