From f1a98bbc6260555f6894d10d6ad7921c6a4c6a41 Mon Sep 17 00:00:00 2001 From: Pierre De Rop Date: Tue, 28 Jun 2022 16:30:12 +0200 Subject: [PATCH] Remove netty5 Unsafe class --- .../java/reactor/netty/transport/ServerTransport.java | 2 +- .../reactor/netty/transport/TransportConnector.java | 4 ++-- .../src/test/java/reactor/netty/ReactorNettyTest.java | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reactor-netty-core/src/main/java/reactor/netty/transport/ServerTransport.java b/reactor-netty-core/src/main/java/reactor/netty/transport/ServerTransport.java index ff340a38ad..a2ea1b7e70 100644 --- a/reactor-netty-core/src/main/java/reactor/netty/transport/ServerTransport.java +++ b/reactor-netty-core/src/main/java/reactor/netty/transport/ServerTransport.java @@ -437,7 +437,7 @@ void initChild(final Channel child) { } static void forceClose(Channel child, Throwable t) { - child.unsafe().closeForcibly(); + child.close(); log.warn(format(child, "Failed to register an accepted channel: {}"), child, t); } } diff --git a/reactor-netty-core/src/main/java/reactor/netty/transport/TransportConnector.java b/reactor-netty-core/src/main/java/reactor/netty/transport/TransportConnector.java index 088d5d6f87..38eaa4ee2f 100644 --- a/reactor-netty-core/src/main/java/reactor/netty/transport/TransportConnector.java +++ b/reactor-netty-core/src/main/java/reactor/netty/transport/TransportConnector.java @@ -323,14 +323,14 @@ static Mono doInitAndRegister( channel.close(); } else { - channel.unsafe().closeForcibly(); + channel.close(); } monoChannelPromise.setFailure(f.cause()); } }); } else { - channel.unsafe().closeForcibly(); + channel.close(); monoChannelPromise.setFailure(future.cause()); } }); diff --git a/reactor-netty-core/src/test/java/reactor/netty/ReactorNettyTest.java b/reactor-netty-core/src/test/java/reactor/netty/ReactorNettyTest.java index 794985be93..aecf35d51d 100644 --- a/reactor-netty-core/src/test/java/reactor/netty/ReactorNettyTest.java +++ b/reactor-netty-core/src/test/java/reactor/netty/ReactorNettyTest.java @@ -22,6 +22,7 @@ import io.netty5.channel.ChannelOutboundBuffer; import io.netty5.channel.ChannelShutdownDirection; import io.netty5.channel.embedded.EmbeddedChannel; +import io.netty5.util.concurrent.Promise; import org.junit.jupiter.api.Test; import reactor.util.annotation.Nullable; @@ -123,11 +124,6 @@ static class TestChannel extends AbstractChannel { this.remoteAddress = remoteAddress; } - @Override - protected AbstractUnsafe newUnsafe() { - return null; - } - @Override public SocketAddress localAddress() { return localAddress0(); @@ -172,6 +168,10 @@ protected void doBeginRead() { protected void doWrite(ChannelOutboundBuffer in) { } + @Override + protected void connectTransport(SocketAddress remoteAddress, SocketAddress localAddress, Promise promise) { + } + @Override public ChannelConfig config() { return null;