NIFI-9233 - Improve reliability of system integration tests (#5720)

This commit is contained in:
greyp9 2022-01-31 09:20:54 -05:00 committed by GitHub
parent 038811d0dd
commit 27ceda38bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 12 deletions

View File

@ -175,6 +175,26 @@ public class ZooKeeperStateServer extends ZooKeeperServerMain {
if (started) {
started = false;
if (quorumPeer != null && quorumPeer.isRunning()) {
quorumPeer.shutdown();
}
if (connectionFactory != null) {
try {
connectionFactory.shutdown();
} catch (Exception e) {
logger.warn("Failed to shutdown Connection Factory", e);
}
}
if (embeddedZkServer != null && embeddedZkServer.isRunning()) {
try {
embeddedZkServer.shutdown();
} catch (Exception e) {
logger.warn("Failed to shutdown Embedded Zookeeper", e);
}
}
if (transactionLog != null) {
try {
transactionLog.close();
@ -183,18 +203,6 @@ public class ZooKeeperStateServer extends ZooKeeperServerMain {
}
}
if (connectionFactory != null) {
connectionFactory.shutdown();
}
if (quorumPeer != null && quorumPeer.isRunning()) {
quorumPeer.shutdown();
}
if (embeddedZkServer != null && embeddedZkServer.isRunning()) {
embeddedZkServer.shutdown();
}
if (datadirCleanupManager != null) {
datadirCleanupManager.shutdown();
}