File tree Expand file tree Collapse file tree
framework/src/main/java/org/tron Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import org .tron .core .db .Manager ;
1111import org .tron .core .net .TronNetService ;
1212import org .tron .core .services .event .EventService ;
13+ import org .tron .program .SolidityNode ;
1314
1415@ Slf4j (topic = "app" )
1516@ Component
@@ -33,6 +34,9 @@ public class ApplicationImpl implements Application {
3334 @ Autowired
3435 private ConsensusService consensusService ;
3536
37+ @ Autowired (required = false )
38+ private SolidityNode solidityNode ;
39+
3640 private final CountDownLatch shutdown = new CountDownLatch (1 );
3741
3842 /**
@@ -55,6 +59,9 @@ public void shutdown() {
5559 }
5660 consensusService .stop ();
5761 eventService .close ();
62+ if (solidityNode != null ) {
63+ solidityNode .close ();
64+ }
5865 dbManager .close ();
5966 shutdown .countDown ();
6067 }
Original file line number Diff line number Diff line change @@ -69,16 +69,26 @@ public void onApplicationEvent(ContextClosedEvent event) {
6969 flag = false ; // invoke earlier than @PreDestroy
7070 }
7171
72- @ PreDestroy
73- private void shutdown () {
72+ public void close () {
7473 flag = false ;
7574 if (databaseGrpcClient != null ) {
7675 databaseGrpcClient .shutdown ();
7776 }
77+ // Interrupt get-block immediately: it may be stuck in blockQueue.put() (full queue,
78+ // process-block stopped) or in a gRPC blocking stub call.
79+ // Do NOT interrupt process-block: let it finish its current pushVerifiedBlock naturally
80+ // (flag=false causes the while-loop to exit within 1-2 s) so the DB flush can complete
81+ // cleanly before ApplicationImpl.shutdown() tears down the underlying executor.
82+ getBlockExecutor .shutdownNow ();
7883 ExecutorServiceManager .shutdownAndAwaitTermination (getBlockExecutor , getBlockName );
7984 ExecutorServiceManager .shutdownAndAwaitTermination (processBlockExecutor , processBlockName );
8085 }
8186
87+ @ PreDestroy
88+ private void shutdown () {
89+ close ();
90+ }
91+
8292 public void run () {
8393 try {
8494 databaseGrpcClient = new DatabaseGrpcClient (CommonParameter .getInstance ().getTrustNodeAddr ());
You can’t perform that action at this time.
0 commit comments