Skip to content

Commit

Permalink
Merge pull request #6095 from halibobo1205/477/backup_thead_pool_clos…
Browse files Browse the repository at this point in the history
…e_opt

feat(backup): make nodes with backup shutdown gracefully by kill -15
  • Loading branch information
CodeNinjaEvan authored Nov 28, 2024
2 parents 160a440 + 2333531 commit 8428480
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public void initChannel(NioDatagramChannel ch)
public void close() {
logger.info("Closing backup server...");
shutdown = true;
ExecutorServiceManager.shutdownAndAwaitTermination(executor, name);
backupManager.stop();
if (channel != null) {
try {
Expand All @@ -104,6 +103,7 @@ public void close() {
logger.warn("Closing backup server failed.", e);
}
}
ExecutorServiceManager.shutdownAndAwaitTermination(executor, name);
logger.info("Backup server closed.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.Timeout;
import org.tron.common.backup.socket.BackupServer;
import org.tron.common.parameter.CommonParameter;
import org.tron.core.Constant;
Expand All @@ -17,6 +18,9 @@ public class BackupServerTest {

@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();

@Rule
public Timeout globalTimeout = Timeout.seconds(60);
private BackupServer backupServer;

@Before
Expand All @@ -40,5 +44,7 @@ public void tearDown() {
@Test
public void test() throws InterruptedException {
backupServer.initServer();
// wait for the server to start
Thread.sleep(1000);
}
}

0 comments on commit 8428480

Please sign in to comment.