Add deprecation to Http2StreamChannelBootstrap.open0(...) as it was marked as public by mistake (#9372)
Motivation: Mark Http2StreamChannelBootstrap.open0(...) as deprecated as the user should not use it. It was marked as public by mistake. Modifications: Add deprecation warning. Result: User will be aware the method should not be used directly.
This commit is contained in:
parent
a136a38778
commit
b0b02d51d2
@ -91,16 +91,24 @@ public final class Http2StreamChannelBootstrap {
|
||||
/**
|
||||
* the {@link ChannelHandler} to use for serving the requests.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Http2StreamChannelBootstrap handler(ChannelHandler handler) {
|
||||
this.handler = requireNonNull(handler, "handler");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new {@link Http2StreamChannel} to use.
|
||||
* @return the {@link Future} that will be notified once the channel was opened successfully or it failed.
|
||||
*/
|
||||
public Future<Http2StreamChannel> open() {
|
||||
return open(channel.eventLoop().newPromise());
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new {@link Http2StreamChannel} to use and notifies the given {@link Promise}.
|
||||
* @return the {@link Future} that will be notified once the channel was opened successfully or it failed.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public Future<Http2StreamChannel> open(final Promise<Http2StreamChannel> promise) {
|
||||
ChannelHandlerContext ctx = channel.pipeline().context(Http2MultiplexCodec.class);
|
||||
if (ctx == null) {
|
||||
@ -125,6 +133,10 @@ public final class Http2StreamChannelBootstrap {
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated should not be used directly. Use {@link #open()} or {@link #open(Promise)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void open0(ChannelHandlerContext ctx, final Promise<Http2StreamChannel> promise) {
|
||||
assert ctx.executor().inEventLoop();
|
||||
final Http2StreamChannel streamChannel;
|
||||
@ -167,7 +179,7 @@ public final class Http2StreamChannelBootstrap {
|
||||
p.addLast(handler);
|
||||
}
|
||||
synchronized (options) {
|
||||
setChannelOptions(channel, options, logger);
|
||||
setChannelOptions(channel, options);
|
||||
}
|
||||
|
||||
synchronized (attrs) {
|
||||
@ -178,15 +190,15 @@ public final class Http2StreamChannelBootstrap {
|
||||
}
|
||||
|
||||
private static void setChannelOptions(
|
||||
Channel channel, Map<ChannelOption<?>, Object> options, InternalLogger logger) {
|
||||
Channel channel, Map<ChannelOption<?>, Object> options) {
|
||||
for (Map.Entry<ChannelOption<?>, Object> e: options.entrySet()) {
|
||||
setChannelOption(channel, e.getKey(), e.getValue(), logger);
|
||||
setChannelOption(channel, e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void setChannelOption(
|
||||
Channel channel, ChannelOption<?> option, Object value, InternalLogger logger) {
|
||||
Channel channel, ChannelOption<?> option, Object value) {
|
||||
try {
|
||||
if (!channel.config().setOption((ChannelOption<Object>) option, value)) {
|
||||
logger.warn("Unknown channel option '{}' for channel '{}'", option, channel);
|
||||
|
Loading…
Reference in New Issue
Block a user