-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is there an existing issue for this?
- I have searched the existing issues
The Problem
In Vert.x 4.4.5 all methods which exposes Netty classes directly are deprecated. NeonBee is using such methods at two places:
- ImmutableBuffer [1], where the ByteBuf class is used
- EventLoopHealthCheck [2], where EventExecutor is used.
Desired Solution
ImmutableBuffer: Could the approach below work?
// Current
ImmutableBuffer(Buffer buffer) {
this(requireNonNull(buffer), buffer.getByteBuf());
}
/**
* Small optimization, as calling {@link Buffer#getByteBuf} will duplicate the underlying buffer.
*
* @param buffer the buffer to wrap
* @param byteBuffer the associated Netty byte-buffer
*/
private ImmutableBuffer(Buffer buffer, ByteBuf byteBuffer) {
// if the underlying byte buffer is read-only already, there is no need to make it any more immutable
this.buffer = byteBuffer.isReadOnly() ? buffer : Buffer.buffer(byteBuffer.asReadOnly());
}
// new
ImmutableBuffer(Buffer buffer) {
this.buffer = buffer instanceOf ImmutableBuffer ? buffer : Buffer.buffer(buffer);
}
EventLoopHealthCheck: I'd suggest to use SuppressWarnings here because:
- The long term solution is, that the metric "pending tasks" will be part of Vert.x Metrics. I talked already with Julien.
- In Vert.x 5 we can use VertxInternal to access the EventExecutor. Of course this is an internal API, but the unofficial agreement is that we won't touch this API until the pending tasks metric is part of Vert.x Metrics.
[1]
this.buffer = byteBuffer.isReadOnly() ? buffer : Buffer.buffer(byteBuffer.asReadOnly()); |
[2]
for (EventExecutor elg : neonBee.getVertx().nettyEventLoopGroup()) { |
Alternative Solutions
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request