Skip to content

Commit

Permalink
Merge pull request #3762 from actiontech/inner-2282
Browse files Browse the repository at this point in the history
[inner-2282] upgrade grpc from 1.5.0 to 1.53.0
  • Loading branch information
wenyh1 authored Jul 7, 2023
2 parents 2885693 + 340b8fc commit 74f37ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<grpc.version>1.5.0</grpc.version><!-- CURRENT_GRPC_VERSION -->
<grpc.version>1.53.0</grpc.version><!-- CURRENT_GRPC_VERSION -->
<log4j2.version>2.18.0</log4j2.version>
</properties>
<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public KvBean getKV(String path) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
output = stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).getKv(input);
} catch (Exception e2) {
Expand Down Expand Up @@ -221,7 +221,7 @@ public List<KvBean> getKVPath(String path) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
output = stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).getKvTree(input);
} catch (Exception e2) {
Expand Down Expand Up @@ -257,7 +257,7 @@ public void cleanPath(String path) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).deleteKvTree(input);
flag = true;
Expand Down Expand Up @@ -288,7 +288,7 @@ public void cleanKV(String path) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).deleteKv(input);
return;
Expand Down Expand Up @@ -321,7 +321,7 @@ public SubscribeReturnBean subscribeKvPrefix(SubscribeRequest request) throws Ex
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS));
UcoreInterface.SubscribeKvPrefixOutput output = stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input);
return groupSubscribeResult(output);
Expand All @@ -346,7 +346,7 @@ public void alert(ClusterAlertBean alert) {
for (String ip : getAvailableIpList()) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip, ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
channel = ManagedChannelBuilder.forAddress(ip, ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).alert(input);
return;
Expand All @@ -370,7 +370,7 @@ public boolean alertResolve(ClusterAlertBean alert) {
for (String ip : getAvailableIpList()) {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip, ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
channel = ManagedChannelBuilder.forAddress(ip, ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).alertResolve(input);
return true;
Expand Down Expand Up @@ -421,7 +421,7 @@ public boolean renewLock(String sessionId, String path) throws Exception {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
stub.withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS).renewSession(input);
return true;
Expand Down Expand Up @@ -463,7 +463,7 @@ public UcoreInterface.SubscribeNodesOutput subscribeNodes(UcoreInterface.Subscri
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS));
return stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeNodes(subscribeNodesInput);
} catch (Exception e2) {
Expand Down Expand Up @@ -595,7 +595,7 @@ private boolean rebuildStub() {
Channel channel = null;
try {
channel = ManagedChannelBuilder.forAddress(ip,
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
channel = ClientInterceptors.intercept(channel, new MetaDataClientInterceptor());
setStubIfPossible(UcoreGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
isSuccess = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public String getRenewThreadPrefix() {
@Override
public void initConInfo() {
Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1",
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
}

Expand All @@ -56,7 +56,7 @@ public void initCluster() {
serverId = SystemConfig.getInstance().getServerId();
sourceComponentId = SystemConfig.getInstance().getInstanceName();
Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1",
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
setStubIfPossible(DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
startUpdateNodes();
ClusterToXml.loadKVtoFile(this);
Expand Down Expand Up @@ -309,7 +309,7 @@ public void run() {
}
LOGGER.warn("error in ucore nodes watch,try for another time", e);
Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1",
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
UshardSender.this.setStubIfPossible(DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS));
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(2000));
}
Expand Down Expand Up @@ -346,7 +346,7 @@ public void attachCluster() throws Exception {
ManagedChannel channel = null;
try {
channel = ManagedChannelBuilder.forAddress("127.0.0.1",
ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();
ClusterConfig.getInstance().getClusterPort()).usePlaintext().build();
stub = DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(ClusterConfig.getInstance().getGrpcTimeout(), TimeUnit.SECONDS);
//check connection is ready
ClusterHelper.isExist(ClusterPathUtil.getOnlinePath(SystemConfig.getInstance().getInstanceName()));
Expand Down

0 comments on commit 74f37ed

Please sign in to comment.