Class SocketOptionUtils
java.lang.Object
io.servicetalk.transport.netty.internal.SocketOptionUtils
Utilities to convert
SocketOption
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
addOption
(Map<io.netty.channel.ChannelOption, Object> channelOpts, SocketOption<T> option, T value) static <T> T
getOption
(SocketOption<T> option, io.netty.channel.ChannelConfig config, Long idleTimeoutMs) Get aSocketOption
value fromChannelConfig
.
-
Method Details
-
addOption
public static <T> void addOption(Map<io.netty.channel.ChannelOption, Object> channelOpts, SocketOption<T> option, T value) - Type Parameters:
T
- the type of theSocketOption
value- Parameters:
channelOpts
- theMap
into which add the convertedSocketOption
option
- theSocketOption
to convert and addvalue
- the value to add- Throws:
IllegalArgumentException
- if the specifiedSocketOption
is not supported
-
getOption
@Nullable public static <T> T getOption(SocketOption<T> option, io.netty.channel.ChannelConfig config, Long idleTimeoutMs) Get aSocketOption
value fromChannelConfig
.- Type Parameters:
T
- the type of theSocketOption
value- Parameters:
option
- theSocketOption
to getconfig
- theChannelConfig
to get theSocketOption
fromidleTimeoutMs
- value forIDLE_TIMEOUT
socket option- Returns:
- a value of the
SocketOption
of typeT
ornull
if theChannelConfig
does not have a value for requestedSocketOption
- Throws:
IllegalArgumentException
- if the specifiedSocketOption
is not supported
-