From b0b02d51d2a652186d79f42fce224a38072fae22 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 16 Jul 2019 13:08:09 +0200 Subject: [PATCH] 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. --- .../http2/Http2StreamChannelBootstrap.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java index 5779aab487..625ceae0a8 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java @@ -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 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 open(final Promise 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 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, Object> options, InternalLogger logger) { + Channel channel, Map, Object> options) { for (Map.Entry, 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) option, value)) { logger.warn("Unknown channel option '{}' for channel '{}'", option, channel);