From fadca3ed4b07d2ea59015e44c2647581f934e62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BF=8A=20SionYang?= Date: Tue, 22 Nov 2022 12:48:46 +0800 Subject: [PATCH] upgrade grpc to 1.50.2 (#904) --- jraft-extension/rpc-grpc-impl/pom.xml | 2 +- .../io/grpc/netty/NettyConnectionHelper.java | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/jraft-extension/rpc-grpc-impl/pom.xml b/jraft-extension/rpc-grpc-impl/pom.xml index 514d96ce8..c9415aba0 100644 --- a/jraft-extension/rpc-grpc-impl/pom.xml +++ b/jraft-extension/rpc-grpc-impl/pom.xml @@ -11,7 +11,7 @@ rpc-grpc-impl ${project.version} - 1.17.0 + 1.50.2 diff --git a/jraft-extension/rpc-grpc-impl/src/main/java/io/grpc/netty/shaded/io/grpc/netty/NettyConnectionHelper.java b/jraft-extension/rpc-grpc-impl/src/main/java/io/grpc/netty/shaded/io/grpc/netty/NettyConnectionHelper.java index 93ccb04c5..6f007733d 100644 --- a/jraft-extension/rpc-grpc-impl/src/main/java/io/grpc/netty/shaded/io/grpc/netty/NettyConnectionHelper.java +++ b/jraft-extension/rpc-grpc-impl/src/main/java/io/grpc/netty/shaded/io/grpc/netty/NettyConnectionHelper.java @@ -33,18 +33,23 @@ */ public class NettyConnectionHelper { - private static final ReferenceFieldUpdater CHANNEL_GETTER = Updaters - .newReferenceFieldUpdater( - NettyServerStream.class, - "channel"); + private static final ReferenceFieldUpdater WRITE_QUEUE_GETTER = Updaters + .newReferenceFieldUpdater( + NettyServerStream.class, + "writeQueue"); - private static final AttributeKey NETTY_CONN_KEY = AttributeKey - .valueOf("netty.conn"); + private static final ReferenceFieldUpdater CHANNEL_GETTER = Updaters + .newReferenceFieldUpdater( + WriteQueue.class, + "channel"); + + private static final AttributeKey NETTY_CONN_KEY = AttributeKey + .valueOf("netty.conn"); public static Connection getOrCreateConnection(final ServerStream stream, final List listeners) { if (stream instanceof NettyServerStream) { - return attachChannel(CHANNEL_GETTER.get((NettyServerStream) stream), listeners); + return attachChannel(CHANNEL_GETTER.get(WRITE_QUEUE_GETTER.get((NettyServerStream) stream)), listeners); } return null; }