public class SocketOptions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SocketOptions.Builder
Builder for
SocketOptions . |
static class |
SocketOptions.KeepAliveOptions
Extended Keep-Alive options (idle, interval, count).
|
static class |
SocketOptions.TcpUserTimeoutOptions
TCP_USER_TIMEOUT comes from RFC5482 , configuring this
parameter can allow the user TCP to initiate a reconnection to solve this problem when the network is abnormal.
|
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_CONNECT_TIMEOUT |
static Duration |
DEFAULT_CONNECT_TIMEOUT_DURATION |
static TimeUnit |
DEFAULT_CONNECT_TIMEOUT_UNIT |
static boolean |
DEFAULT_SO_KEEPALIVE |
static boolean |
DEFAULT_SO_NO_DELAY |
static boolean |
DEFAULT_TCP_USER_TIMEOUT_ENABLED |
Modifier | Constructor and Description |
---|---|
protected |
SocketOptions(SocketOptions.Builder builder) |
protected |
SocketOptions(SocketOptions original) |
Modifier and Type | Method and Description |
---|---|
static SocketOptions.Builder |
builder()
Returns a new
SocketOptions.Builder to construct SocketOptions . |
static SocketOptions |
copyOf(SocketOptions options)
Create a copy of options
|
static SocketOptions |
create()
Create a new
SocketOptions using default settings. |
Duration |
getConnectTimeout()
Returns the connection timeout.
|
SocketOptions.KeepAliveOptions |
getKeepAlive()
Returns the TCP keepalive options.
|
SocketOptions.TcpUserTimeoutOptions |
getTcpUserTimeout() |
boolean |
isEnableTcpUserTimeout() |
boolean |
isKeepAlive()
Returns whether to enable TCP keepalive.
|
boolean |
isTcpNoDelay()
Returns whether to use TCP NoDelay.
|
SocketOptions.Builder |
mutate()
Returns a builder to create new
SocketOptions whose settings are replicated from the current
SocketOptions . |
public static final long DEFAULT_CONNECT_TIMEOUT
public static final TimeUnit DEFAULT_CONNECT_TIMEOUT_UNIT
public static final Duration DEFAULT_CONNECT_TIMEOUT_DURATION
public static final boolean DEFAULT_SO_KEEPALIVE
public static final boolean DEFAULT_TCP_USER_TIMEOUT_ENABLED
public static final boolean DEFAULT_SO_NO_DELAY
protected SocketOptions(SocketOptions.Builder builder)
protected SocketOptions(SocketOptions original)
public static SocketOptions copyOf(SocketOptions options)
options
- the originalSocketOptions
containing the values of optionspublic static SocketOptions.Builder builder()
SocketOptions.Builder
to construct SocketOptions
.SocketOptions.Builder
to construct SocketOptions
.public static SocketOptions create()
SocketOptions
using default settings.public SocketOptions.Builder mutate()
SocketOptions
whose settings are replicated from the current
SocketOptions
.SocketOptions.Builder
to create new SocketOptions
whose settings are replicated from the
current SocketOptions
public Duration getConnectTimeout()
public boolean isKeepAlive()
SocketOptions.SO_KEEPALIVE
public SocketOptions.KeepAliveOptions getKeepAlive()
SocketOptions.KeepAliveOptions
public boolean isTcpNoDelay()
true
to disable Nagle's algorithm, false
to enable Nagle's algorithm.SocketOptions.TCP_NODELAY
public boolean isEnableTcpUserTimeout()
public SocketOptions.TcpUserTimeoutOptions getTcpUserTimeout()
Copyright © 2023 lettuce.io. All rights reserved.