Skip to content

Commit d0bdaf0

Browse files
author
Sunny Jiao
committed
revert changes
1 parent fd996c5 commit d0bdaf0

File tree

4 files changed

+19
-103
lines changed

4 files changed

+19
-103
lines changed

framework/src/main/java/org/tron/common/application/RpcService.java

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import io.grpc.netty.NettyServerBuilder;
2020
import io.grpc.protobuf.services.ProtoReflectionService;
2121
import java.util.concurrent.CompletableFuture;
22-
import java.util.concurrent.ExecutorService;
2322
import java.util.concurrent.TimeUnit;
2423
import lombok.extern.slf4j.Slf4j;
2524
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +34,6 @@
3534
public abstract class RpcService extends AbstractService {
3635

3736
private Server apiServer;
38-
private ExecutorService executorService;
3937
protected String executorName;
4038

4139
@Autowired
@@ -60,24 +58,7 @@ public void innerStart() throws Exception {
6058
@Override
6159
public void innerStop() throws Exception {
6260
if (this.apiServer != null) {
63-
this.apiServer.shutdown();
64-
try {
65-
if (!this.apiServer.awaitTermination(5, TimeUnit.SECONDS)) {
66-
logger.warn("gRPC server did not shutdown gracefully, forcing shutdown");
67-
this.apiServer.shutdownNow();
68-
}
69-
} catch (InterruptedException e) {
70-
logger.warn("Interrupted while waiting for gRPC server shutdown", e);
71-
this.apiServer.shutdownNow();
72-
Thread.currentThread().interrupt();
73-
}
74-
}
75-
76-
// Close executor
77-
if (this.executorService != null) {
78-
ExecutorServiceManager.shutdownAndAwaitTermination(
79-
this.executorService, this.executorName);
80-
this.executorService = null;
61+
this.apiServer.shutdown().awaitTermination(5, TimeUnit.SECONDS);
8162
}
8263
}
8364

@@ -95,9 +76,9 @@ protected NettyServerBuilder initServerBuilder() {
9576
NettyServerBuilder serverBuilder = NettyServerBuilder.forPort(this.port);
9677
CommonParameter parameter = Args.getInstance();
9778
if (parameter.getRpcThreadNum() > 0) {
98-
this.executorService = ExecutorServiceManager.newFixedThreadPool(
99-
this.executorName, parameter.getRpcThreadNum());
100-
serverBuilder = serverBuilder.executor(this.executorService);
79+
serverBuilder = serverBuilder
80+
.executor(ExecutorServiceManager.newFixedThreadPool(
81+
this.executorName, parameter.getRpcThreadNum()));
10182
}
10283
// Set configs from config.conf or default value
10384
serverBuilder

framework/src/test/java/org/tron/core/services/RpcApiServicesTest.java

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.grpc.ManagedChannelBuilder;
1212
import java.io.IOException;
1313
import java.util.Objects;
14-
import java.util.concurrent.ExecutorService;
1514
import java.util.concurrent.TimeUnit;
1615
import org.junit.AfterClass;
1716
import org.junit.Assert;
@@ -54,7 +53,6 @@
5453
import org.tron.common.application.Application;
5554
import org.tron.common.application.ApplicationFactory;
5655
import org.tron.common.application.TronApplicationContext;
57-
import org.tron.common.es.ExecutorServiceManager;
5856
import org.tron.common.utils.ByteArray;
5957
import org.tron.common.utils.PublicMethod;
6058
import org.tron.common.utils.Sha256Hash;
@@ -142,9 +140,6 @@ public class RpcApiServicesTest {
142140
private static ByteString ivk;
143141
private static ByteString d;
144142

145-
private static ExecutorService executorService;
146-
private static final String executorName = "rpc-test-executor";
147-
148143
@BeforeClass
149144
public static void init() throws IOException {
150145
Args.setParam(new String[] {"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
@@ -168,22 +163,16 @@ public static void init() throws IOException {
168163
String pBFTNode = String.format("%s:%d", Constant.LOCAL_HOST,
169164
getInstance().getRpcOnPBFTPort());
170165

171-
executorService = ExecutorServiceManager.newFixedThreadPool(
172-
executorName, 3);
173-
174166
channelFull = ManagedChannelBuilder.forTarget(fullNode)
175167
.usePlaintext()
176-
.executor(executorService)
177168
.intercept(new TimeoutInterceptor(5000))
178169
.build();
179170
channelPBFT = ManagedChannelBuilder.forTarget(pBFTNode)
180171
.usePlaintext()
181-
.executor(executorService)
182172
.intercept(new TimeoutInterceptor(5000))
183173
.build();
184174
channelSolidity = ManagedChannelBuilder.forTarget(solidityNode)
185175
.usePlaintext()
186-
.executor(executorService)
187176
.intercept(new TimeoutInterceptor(5000))
188177
.build();
189178
context = new TronApplicationContext(DefaultConfig.class);
@@ -208,45 +197,17 @@ public static void init() throws IOException {
208197

209198
@AfterClass
210199
public static void destroy() {
211-
shutdownChannel(channelFull);
212-
shutdownChannel(channelPBFT);
213-
shutdownChannel(channelSolidity);
214-
215-
if (executorService != null) {
216-
ExecutorServiceManager.shutdownAndAwaitTermination(
217-
executorService, executorName);
218-
executorService = null;
200+
if (channelFull != null) {
201+
channelFull.shutdownNow();
219202
}
220-
221-
context.close();
222-
Args.clearParam();
223-
}
224-
225-
private static void shutdownChannel(ManagedChannel channel) {
226-
if (channel == null) {
227-
return;
203+
if (channelPBFT != null) {
204+
channelPBFT.shutdownNow();
228205
}
229-
try {
230-
channel.shutdown();
231-
if (!channel.awaitTermination(5, TimeUnit.SECONDS)) {
232-
channel.shutdownNow();
233-
}
234-
} catch (InterruptedException e) {
235-
channel.shutdownNow();
236-
Thread.currentThread().interrupt();
206+
if (channelSolidity != null) {
207+
channelSolidity.shutdownNow();
237208
}
238-
}
239-
240-
@Before
241-
public void start() {
242-
logger.debug("========== Starting test: {} ==========", name.getMethodName());
243-
System.out.println("========== Starting test: " + name.getMethodName() + " ==========");
244-
}
245-
246-
@After
247-
public void end() throws InterruptedException {
248-
logger.debug("========== Ending test: {} ==========", name.getMethodName());
249-
System.out.println("========== Ending test: " + name.getMethodName() + " ==========");
209+
context.close();
210+
Args.clearParam();
250211
}
251212

252213
@Test

gradle/verification-metadata.xml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -846,15 +846,15 @@
846846
<sha256 value="8719f349cd542ae3ce523ac3992513a8c04020621bc86e880a79afa5f1aaf589" origin="Generated by Gradle"/>
847847
</artifact>
848848
</component>
849-
<component group="io.github.tronprotocol" name="libp2p" version="2.2.7">
850-
<artifact name="libp2p-2.2.7.jar">
851-
<sha256 value="6cf446b68723299e41189bd17d1605544ec4e8bada3830c7fa54d043b22b2208" origin="Generated by Gradle"/>
849+
<component group="io.github.tronprotocol" name="libp2p" version="2.2.6">
850+
<artifact name="libp2p-2.2.6.jar">
851+
<sha256 value="b56584e6b6906b143fc915382aed5a6d98d8c5a5162fdb3320f58ef6f89e33e1" origin="Generated by Gradle"/>
852852
</artifact>
853-
<artifact name="libp2p-2.2.7.module">
854-
<sha256 value="8dcf317770be76db50d2f5dd694f5b0edba98e2bf147626d9b49bbd888669689" origin="Generated by Gradle"/>
853+
<artifact name="libp2p-2.2.6.module">
854+
<sha256 value="5eae986fb325d159eedba81e1173738597048ac8b3ac171d6cd03bd7bfb398d1" origin="Generated by Gradle"/>
855855
</artifact>
856-
<artifact name="libp2p-2.2.7.pom">
857-
<sha256 value="91ddb2a384207b401efa0d68b84f06ff9151fce8843e1ece3e5cf63875c1cd84" origin="Generated by Gradle"/>
856+
<artifact name="libp2p-2.2.6.pom">
857+
<sha256 value="6481cca729eee0f9ed796d3db601e890452eb0ed94d2f70bdb33ccd1816ae17d" origin="Generated by Gradle"/>
858858
</artifact>
859859
</component>
860860
<component group="io.github.tronprotocol" name="zksnark-java-sdk" version="1.0.0">
@@ -1039,22 +1039,6 @@
10391039
<sha256 value="22b49f09ab47f5bc6a6d1a572692b373f0647236877b1030f0eb52e8ee678258" origin="Generated by Gradle"/>
10401040
</artifact>
10411041
</component>
1042-
<component group="io.netty" name="netty-transport-classes-epoll" version="4.1.124.Final">
1043-
<artifact name="netty-transport-classes-epoll-4.1.124.Final.jar">
1044-
<sha256 value="a098c9a095961c8b118f9352bf23c443e0de7c53db2afa0db189d703aed53ef8" origin="Generated by Gradle"/>
1045-
</artifact>
1046-
<artifact name="netty-transport-classes-epoll-4.1.124.Final.pom">
1047-
<sha256 value="32af1974d8b0f6d28112e056fb75e7365c89f3a19a9abdae5cc1caed99028f42" origin="Generated by Gradle"/>
1048-
</artifact>
1049-
</component>
1050-
<component group="io.netty" name="netty-transport-native-epoll" version="4.1.124.Final">
1051-
<artifact name="netty-transport-native-epoll-4.1.124.Final-linux-aarch_64.jar">
1052-
<sha256 value="89e18fd1c2025467229c20bbca28c79e52eefb2ac5d6ce6d32641293c37e5e56" origin="Generated by Gradle"/>
1053-
</artifact>
1054-
<artifact name="netty-transport-native-epoll-4.1.124.Final.pom">
1055-
<sha256 value="2508cebd61c7c25d2d50c95e8ebffad8f81f52baff6185a0a45d198dd8b2606e" origin="Generated by Gradle"/>
1056-
</artifact>
1057-
</component>
10581042
<component group="io.netty" name="netty-transport-native-unix-common" version="4.1.124.Final">
10591043
<artifact name="netty-transport-native-unix-common-4.1.124.Final.jar">
10601044
<sha256 value="5b824b485345d3eb4f29bd96005fe71d4bdcda3e4453a834fd58f7e113346115" origin="Generated by Gradle"/>

protocol/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ apply plugin: 'com.google.protobuf'
33
def protobufVersion = '3.25.8'
44
def grpcVersion = '1.75.0'
55
def protocGenVersion = '1.60.0' // https://github.com/grpc/grpc-java/pull/11371 , 1.64.x is not supported CentOS 7.
6-
def nettyVersion = '4.1.124.Final' // Match the Netty version used by grpc-netty 1.75.0
76

87
dependencies {
98
api group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion
@@ -20,15 +19,6 @@ dependencies {
2019

2120
// end google grpc
2221

23-
// Add Epoll support for ARM64 Linux only
24-
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
25-
def arch = System.getProperty("os.arch").toLowerCase()
26-
if (arch.contains("aarch") || arch.contains("arm")) {
27-
api group: 'io.netty', name: 'netty-transport-native-epoll',
28-
version: nettyVersion, classifier: 'linux-aarch_64'
29-
}
30-
}
31-
3222
api group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.15.0'
3323
}
3424

0 commit comments

Comments
 (0)