@InterfaceAudience.Private public final class NettyFutureUtils extends Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
Modifier | Constructor and Description |
---|---|
private |
NettyFutureUtils() |
Modifier and Type | Method and Description |
---|---|
static <V> void |
addListener(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<V> future,
org.apache.hbase.thirdparty.io.netty.util.concurrent.GenericFutureListener<? extends org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<? super V>> listener)
This is method is used when you just want to add a listener to the given netty future.
|
static void |
consume(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<?> future)
Log the error if the future indicates any failure.
|
private static void |
loggingWhenError(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<?> future) |
static void |
safeClose(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel)
Close the channel and eat the returned future by logging the error when the future is completed
with error.
|
static void |
safeWrite(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel,
Object msg)
Call write on the channel and eat the returned future by logging the error when the future is
completed with error.
|
static void |
safeWriteAndFlush(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel,
Object msg)
Call writeAndFlush on the channel and eat the returned future by logging the error when the
future is completed with error.
|
private static final org.slf4j.Logger LOG
private NettyFutureUtils()
public static <V> void addListener(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<V> future, org.apache.hbase.thirdparty.io.netty.util.concurrent.GenericFutureListener<? extends org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<? super V>> listener)
listener
to catch possible code bugs.
And the error phone check will always report FutureReturnValueIgnored because every method in
the Future
class will return a new Future
, so you always have one future that
has not been checked. So we introduce this method and add a suppress warnings annotation here.private static void loggingWhenError(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<?> future)
public static void consume(org.apache.hbase.thirdparty.io.netty.util.concurrent.Future<?> future)
public static void safeClose(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel)
public static void safeWrite(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel, Object msg)
public static void safeWriteAndFlush(org.apache.hbase.thirdparty.io.netty.channel.ChannelOutboundInvoker channel, Object msg)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.