Class ChannelCloseUtils
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.ChannelCloseUtils
-
public final class ChannelCloseUtils extends java.lang.Object
Utilities to handleChannel
closure and its reason.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assignConnectionError(io.netty.channel.Channel channel, java.lang.Throwable error)
Assigns aThrowable
to the passedChannel
to report it as a closure reason.static java.lang.Throwable
channelError(io.netty.channel.Channel channel)
Returns anerror
associated with the passedChannel
.static io.netty.channel.ChannelFuture
close(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable error)
Close the passedChannelHandlerContext
due to the observederror
.static io.netty.channel.ChannelFuture
close(io.netty.channel.Channel channel, java.lang.Throwable error)
Close the passedChannel
due to the observederror
.
-
-
-
Method Detail
-
assignConnectionError
public static void assignConnectionError(io.netty.channel.Channel channel, java.lang.Throwable error)
Assigns aThrowable
to the passedChannel
to report it as a closure reason.- Parameters:
channel
- aChannel
to assign aThrowable
toerror
- aThrowable
-
close
public static io.netty.channel.ChannelFuture close(io.netty.channel.Channel channel, java.lang.Throwable error)
Close the passedChannel
due to the observederror
.- Parameters:
channel
- aChannel
to closeerror
- aerror
that leads to theChannel
closure- Returns:
ChannelFuture
that will be notified once the operation completes
-
close
public static io.netty.channel.ChannelFuture close(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable error)
Close the passedChannelHandlerContext
due to the observederror
.- Parameters:
ctx
- aChannelHandlerContext
to closeerror
- aerror
that leads to theChannelHandlerContext
closure- Returns:
ChannelFuture
that will be notified once the operation completes
-
channelError
@Nullable public static java.lang.Throwable channelError(io.netty.channel.Channel channel)
Returns anerror
associated with the passedChannel
.- Parameters:
channel
- to look for aThrowable
- Returns:
- an
error
associated with the passedChannel
-
-