Class SocketOptionUtils
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.SocketOptionUtils
-
public final class SocketOptionUtils extends java.lang.Object
Utilities to convertSocketOption
s.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
addOption(java.util.Map<io.netty.channel.ChannelOption,java.lang.Object> channelOpts, java.net.SocketOption<T> option, java.lang.Object value)
Convert and add the givenSocketOption
and value to theChannelOption
sMap
.static <T> T
getOption(java.net.SocketOption<T> option, io.netty.channel.ChannelConfig config, java.lang.Long idleTimeoutMs)
Get aSocketOption
value fromChannelConfig
.
-
-
-
Method Detail
-
addOption
public static <T> void addOption(java.util.Map<io.netty.channel.ChannelOption,java.lang.Object> channelOpts, java.net.SocketOption<T> option, java.lang.Object value)
Convert and add the givenSocketOption
and value to theChannelOption
sMap
.- 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:
java.lang.IllegalArgumentException
- if the specifiedSocketOption
is not supported
-
getOption
@Nullable public static <T> T getOption(java.net.SocketOption<T> option, io.netty.channel.ChannelConfig config, @Nullable java.lang.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:
java.lang.IllegalArgumentException
- if the specifiedSocketOption
is not supported
-
-