Skip to content

Commit

Permalink
The Vert.x API exposes the Netty API in its public API, allowing inte…
Browse files Browse the repository at this point in the history
…ractions with the Netty API. Since Netty is evolving toward Netty 5, we should remove Netty API from the Vert.x public API in Vert.x 5 to have the opportunity to change the underlying Netty version used by Vert.x without worrying about the version of the Netty version.

Such API continues to exist in Vert.x 5 but is moved to internal API which more easily change, therefore experimented users of this API can continue to use it granted that the version of Vert.x 5 uses Netty 4.

In practice most users should not use this API, and the deprecation should be seen also as a signal toward users of this API.
  • Loading branch information
vietj committed Jul 26, 2023
1 parent 5f307e7 commit b2b520d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,10 @@ default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handle
* Return the Netty EventLoopGroup used by Vert.x
*
* @return the EventLoopGroup
* @deprecated removed from public API in Vert.x 5
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
@Deprecated
EventLoopGroup nettyEventLoopGroup();

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/vertx/core/buffer/Buffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ static Buffer buffer(byte[] bytes) {
*
* @param byteBuf the Netty ByteBuf
* @return the buffer
* @deprecated removed from public API in Vert.x 5
*/
@Deprecated
@GenIgnore(GenIgnore.PERMITTED_TYPE)
static Buffer buffer(ByteBuf byteBuf) {
Objects.requireNonNull(byteBuf);
Expand Down Expand Up @@ -705,7 +707,10 @@ default Object toJson() {
* Returns the Buffer as a Netty {@code ByteBuf}.
*
* <p> The returned buffer is a duplicate that maintain its own indices.
*
* @deprecated removed from public API in Vert.x 5
*/
@Deprecated
@GenIgnore(GenIgnore.PERMITTED_TYPE)
ByteBuf getByteBuf();

Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/vertx/core/impl/VertxInternal.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.netty.channel.EventLoop;
import io.netty.channel.EventLoopGroup;
import io.netty.resolver.AddressResolverGroup;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.core.*;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void testAsyncResolveConnectIsNotifiedOnChannelEventLoop() throws Excepti
CountDownLatch connectLatch = new CountDownLatch(1);
Bootstrap bootstrap = new Bootstrap();
bootstrap.channelFactory(((VertxInternal)vertx).transport().channelFactory(false));
bootstrap.group(vertx.nettyEventLoopGroup());
bootstrap.group(((VertxInternal) vertx).getEventLoopGroup());
bootstrap.resolver(((VertxInternal) vertx).nettyAddressResolverGroup());
bootstrap.handler(new ChannelInitializer<Channel>() {
@Override
Expand Down

0 comments on commit b2b520d

Please sign in to comment.