Skip to content

Commit 6550dfb

Browse files
committed
fix(backup/backupServer): make the thread pool close after the netty channel closes
1 parent d383177 commit 6550dfb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

framework/src/main/java/org/tron/common/backup/socket/BackupServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public void initChannel(NioDatagramChannel ch)
9595
public void close() {
9696
logger.info("Closing backup server...");
9797
shutdown = true;
98-
ExecutorServiceManager.shutdownAndAwaitTermination(executor, name);
9998
backupManager.stop();
10099
if (channel != null) {
101100
try {
@@ -104,6 +103,7 @@ public void close() {
104103
logger.warn("Closing backup server failed.", e);
105104
}
106105
}
106+
ExecutorServiceManager.shutdownAndAwaitTermination(executor, name);
107107
logger.info("Backup server closed.");
108108
}
109109
}

framework/src/test/java/org/tron/common/backup/BackupServerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public void tearDown() {
3737
Args.clearParam();
3838
}
3939

40-
@Test
40+
@Test(timeout = 60_000)
4141
public void test() throws InterruptedException {
4242
backupServer.initServer();
43+
// wait for the server to start
44+
Thread.sleep(1000);
4345
}
4446
}

0 commit comments

Comments
 (0)