|
22 | 22 | import io.netty.channel.ChannelHandlerContext; |
23 | 23 | import io.netty.channel.ChannelOption; |
24 | 24 | import io.netty.channel.ChannelPipeline; |
| 25 | +import io.netty.channel.EventLoop; |
25 | 26 | import io.netty.handler.codec.LengthFieldBasedFrameDecoder; |
26 | 27 | import io.netty.handler.logging.LogLevel; |
27 | 28 | import io.netty.handler.logging.LoggingHandler; |
|
54 | 55 | import reactor.core.publisher.Mono; |
55 | 56 | import reactor.core.publisher.Operators; |
56 | 57 | import reactor.core.publisher.Sinks; |
| 58 | +import reactor.core.scheduler.Scheduler; |
57 | 59 | import reactor.core.scheduler.Schedulers; |
58 | 60 | import reactor.netty.Connection; |
59 | 61 | import reactor.netty.channel.AbortedException; |
@@ -107,6 +109,8 @@ public final class ReactorNettyClient implements Client { |
107 | 109 |
|
108 | 110 | private final Connection connection; |
109 | 111 |
|
| 112 | + private final Scheduler scheduler; |
| 113 | + |
110 | 114 | private ConnectionContext context; |
111 | 115 |
|
112 | 116 | private final Sinks.Many<Publisher<FrontendMessage>> requestSink = Sinks.many().unicast().onBackpressureBuffer(); |
@@ -150,6 +154,9 @@ private ReactorNettyClient(Connection connection, ConnectionSettings settings) { |
150 | 154 | this.byteBufAllocator = connection.outbound().alloc(); |
151 | 155 | this.context = new ConnectionContext().withChannelId(connection.channel().toString()); |
152 | 156 |
|
| 157 | + EventLoop eventLoop = connection.channel().eventLoop(); |
| 158 | + this.scheduler = Schedulers.fromExecutorService(eventLoop, eventLoop.toString()); |
| 159 | + |
153 | 160 | AtomicReference<Throwable> receiveError = new AtomicReference<>(); |
154 | 161 |
|
155 | 162 | connection.inbound().receive() |
@@ -453,6 +460,11 @@ public Optional<Integer> getProcessId() { |
453 | 460 | return Optional.ofNullable(this.processId); |
454 | 461 | } |
455 | 462 |
|
| 463 | + @Override |
| 464 | + public Scheduler getScheduler() { |
| 465 | + return this.scheduler; |
| 466 | + } |
| 467 | + |
456 | 468 | @Override |
457 | 469 | public Optional<Integer> getSecretKey() { |
458 | 470 | return Optional.ofNullable(this.secretKey); |
|
0 commit comments