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() and getInterval() is seconds.
- Since:
- 6.1
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSocketOptions.KeepAliveOptions.BuilderBuilder forSocketOptions.KeepAliveOptions. -
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_COUNTstatic DurationDEFAULT_IDLEstatic DurationDEFAULT_INTERVAL -
Method Summary
Modifier and Type Method Description static SocketOptions.KeepAliveOptions.Builderbuilder()Returns a newSocketOptions.KeepAliveOptions.Builderto constructSocketOptions.KeepAliveOptions.intgetCount()Returns the maximum number of keepalive probes TCP should send before dropping the connection.DurationgetIdle()The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled.DurationgetInterval()The time between individual keepalive probes.booleanisEnabled()Returns whether to enable TCP keepalive.SocketOptions.KeepAliveOptions.Buildermutate()Returns a builder to create newSocketOptions.KeepAliveOptionswhose settings are replicated from the currentSocketOptions.KeepAliveOptions.
-
Field Details
-
DEFAULT_COUNT
public static final int DEFAULT_COUNT- See Also:
- Constant Field Values
-
DEFAULT_IDLE
-
DEFAULT_INTERVAL
-
-
Method Details
-
builder
Returns a newSocketOptions.KeepAliveOptions.Builderto constructSocketOptions.KeepAliveOptions.- Returns:
- a new
SocketOptions.KeepAliveOptions.Builderto constructSocketOptions.KeepAliveOptions.
-
mutate
Returns a builder to create newSocketOptions.KeepAliveOptionswhose settings are replicated from the currentSocketOptions.KeepAliveOptions.- Returns:
- a
SocketOptions.KeepAliveOptions.Builderto create newSocketOptions.KeepAliveOptionswhose 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_COUNTandTCP_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
The time the connection needs to remain idle before TCP starts sending keepalive probes if keepalive is enabled. Defaults to2 hours. See also @linkDEFAULT_IDLEandTCP_KEEPIDLE.The time granularity of is seconds.
- Returns:
- the time the connection needs to remain idle before TCP starts sending keepalive probes.
-
getInterval
The time between individual keepalive probes. Defaults to1 second. See alsoDEFAULT_INTERVALandTCP_KEEPINTVL.The time granularity of is seconds.
- Returns:
- the time the connection needs to remain idle before TCP starts sending keepalive probes.
-