Skip to content

Commit

Permalink
Remove Netty specific API from Vert.x public API
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Jul 26, 2023
1 parent c5b29b1 commit a4d85b9
Show file tree
Hide file tree
Showing 38 changed files with 403 additions and 256 deletions.
8 changes: 0 additions & 8 deletions src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,14 +482,6 @@ default Future<String> deployVerticle(String name) {
return executeBlocking(blockingCodeHandler, true);
}

/**
* Return the Netty EventLoopGroup used by Vert.x
*
* @return the EventLoopGroup
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
EventLoopGroup nettyEventLoopGroup();

/**
* Like {@link #createSharedWorkerExecutor(String, int)} but with the {@link VertxOptions#setWorkerPoolSize} {@code poolSize}.
*/
Expand Down
45 changes: 6 additions & 39 deletions src/main/java/io/vertx/core/buffer/Buffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
package io.vertx.core.buffer;


import io.netty.buffer.ByteBuf;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.buffer.impl.BufferImpl;
import io.vertx.core.buffer.impl.BufferInternal;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
Expand All @@ -25,7 +24,6 @@

import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Objects;

/**
* Most data is shuffled around inside Vert.x using buffers.
Expand All @@ -46,7 +44,7 @@ public interface Buffer extends ClusterSerializable, Shareable {
* @return the buffer
*/
static Buffer buffer() {
return BufferImpl.buffer();
return BufferInternal.buffer();
}

/**
Expand All @@ -59,7 +57,7 @@ static Buffer buffer() {
* @return the buffer
*/
static Buffer buffer(int initialSizeHint) {
return BufferImpl.buffer(initialSizeHint);
return BufferInternal.buffer(initialSizeHint);
}

/**
Expand All @@ -69,7 +67,7 @@ static Buffer buffer(int initialSizeHint) {
* @return the buffer
*/
static Buffer buffer(String string) {
return BufferImpl.buffer(string);
return BufferInternal.buffer(string);
}

/**
Expand All @@ -80,7 +78,7 @@ static Buffer buffer(String string) {
* @return the buffer
*/
static Buffer buffer(String string, String enc) {
return BufferImpl.buffer(string, enc);
return BufferInternal.buffer(string, enc);
}

/**
Expand All @@ -91,30 +89,7 @@ static Buffer buffer(String string, String enc) {
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
static Buffer buffer(byte[] bytes) {
return BufferImpl.buffer(bytes);
}

/**
* <p>
* Create a new buffer from a Netty {@code ByteBuf}.
* <i>Note that</i> the returned buffer is backed by given Netty ByteBuf,
* so changes in the returned buffer are reflected in given Netty ByteBuf, and vice-versa.
* </p>
* <p>
* For example, both buffers in the code below share their data:
* </p>
* <pre>
* Buffer src = Buffer.buffer();
* Buffer clone = Buffer.buffer(src.getByteBuf());
* </pre>
*
* @param byteBuf the Netty ByteBuf
* @return the buffer
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
static Buffer buffer(ByteBuf byteBuf) {
Objects.requireNonNull(byteBuf);
return BufferImpl.buffer(byteBuf);
return BufferInternal.buffer(bytes);
}

/**
Expand Down Expand Up @@ -701,12 +676,4 @@ default Object toJson() {
*/
Buffer slice(int start, int end);

/**
* Returns the Buffer as a Netty {@code ByteBuf}.
*
* <p> The returned buffer is a duplicate that maintain its own indices.
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
ByteBuf getByteBuf();

}
Loading

0 comments on commit a4d85b9

Please sign in to comment.