Class ChannelCloseUtils
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.ChannelCloseUtils
-
public final class ChannelCloseUtils extends java.lang.ObjectUtilities to handleChannelclosure and its reason.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassignConnectionError(io.netty.channel.Channel channel, java.lang.Throwable error)Assigns aThrowableto the passedChannelto report it as a closure reason.static java.lang.ThrowablechannelError(io.netty.channel.Channel channel)Returns anerrorassociated with the passedChannel.static io.netty.channel.ChannelFutureclose(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable error)Close the passedChannelHandlerContextdue to the observederror.static io.netty.channel.ChannelFutureclose(io.netty.channel.Channel channel, java.lang.Throwable error)Close the passedChanneldue to the observederror.
-
-
-
Method Detail
-
assignConnectionError
public static void assignConnectionError(io.netty.channel.Channel channel, java.lang.Throwable error)Assigns aThrowableto the passedChannelto report it as a closure reason.- Parameters:
channel- aChannelto assign aThrowabletoerror- aThrowable
-
close
public static io.netty.channel.ChannelFuture close(io.netty.channel.Channel channel, java.lang.Throwable error)Close the passedChanneldue to the observederror.- Parameters:
channel- aChannelto closeerror- aerrorthat leads to theChannelclosure- Returns:
ChannelFuturethat 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 passedChannelHandlerContextdue to the observederror.- Parameters:
ctx- aChannelHandlerContextto closeerror- aerrorthat leads to theChannelHandlerContextclosure- Returns:
ChannelFuturethat will be notified once the operation completes
-
channelError
@Nullable public static java.lang.Throwable channelError(io.netty.channel.Channel channel)
Returns anerrorassociated with the passedChannel.- Parameters:
channel- to look for aThrowable- Returns:
- an
errorassociated with the passedChannel
-
-