You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vp...@apache.org on 2023/07/24 08:49:57 UTC
[ignite-3] branch main updated: IGNITE-20011 Shutdown NodeStatusWatchListener executor service after stop (#2340)
This is an automated email from the ASF dual-hosted git repository.
vpyatkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 16aaee407c IGNITE-20011 Shutdown NodeStatusWatchListener executor service after stop (#2340)
16aaee407c is described below
commit 16aaee407c2463929eac0d8dd208221452dfdc06
Author: Mikhail <Po...@users.noreply.github.com>
AuthorDate: Mon Jul 24 11:49:51 2023 +0300
IGNITE-20011 Shutdown NodeStatusWatchListener executor service after stop (#2340)
---
.../internal/deployunit/DeploymentManagerImpl.java | 1 +
.../metastore/NodeStatusWatchListener.java | 4 ++++
.../metastore/DeploymentUnitStoreImplTest.java | 25 ++++++++++++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
index ba657e6104..2176715195 100644
--- a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
+++ b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/DeploymentManagerImpl.java
@@ -401,6 +401,7 @@ public class DeploymentManagerImpl implements IgniteDeployment {
@Override
public void stop() throws Exception {
deployer.stop();
+ nodeStatusWatchListener.stop();
tracker.cancelAll();
deploymentUnitStore.unregisterNodeStatusListener(nodeStatusWatchListener);
deploymentUnitStore.unregisterClusterStatusListener(clusterStatusWatchListener);
diff --git a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/NodeStatusWatchListener.java b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/NodeStatusWatchListener.java
index 4b8ff48294..88e04f1a27 100644
--- a/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/NodeStatusWatchListener.java
+++ b/modules/code-deployment/src/main/java/org/apache/ignite/internal/deployunit/metastore/NodeStatusWatchListener.java
@@ -88,4 +88,8 @@ public class NodeStatusWatchListener implements WatchListener {
public void onError(Throwable e) {
LOG.warn("Failed to process metastore deployment unit event. ", e);
}
+
+ public void stop() {
+ executor.shutdown();
+ }
}
diff --git a/modules/code-deployment/src/test/java/org/apache/ignite/deployment/metastore/DeploymentUnitStoreImplTest.java b/modules/code-deployment/src/test/java/org/apache/ignite/deployment/metastore/DeploymentUnitStoreImplTest.java
index 3e15498d31..663b3993e2 100644
--- a/modules/code-deployment/src/test/java/org/apache/ignite/deployment/metastore/DeploymentUnitStoreImplTest.java
+++ b/modules/code-deployment/src/test/java/org/apache/ignite/deployment/metastore/DeploymentUnitStoreImplTest.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.vault.VaultManager;
import org.apache.ignite.internal.vault.inmemory.InMemoryVaultService;
+import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -84,6 +85,8 @@ public class DeploymentUnitStoreImplTest {
private DeploymentUnitStoreImpl metastore;
+ private Runnable toStop;
+
@WorkDirectory
private Path workDir;
@@ -95,15 +98,33 @@ public class DeploymentUnitStoreImplTest {
MetaStorageManager metaStorageManager = StandaloneMetaStorageManager.create(vaultManager, storage);
metastore = new DeploymentUnitStoreImpl(metaStorageManager);
- metastore.registerNodeStatusListener(new NodeStatusWatchListener(metastore, LOCAL_NODE, nodeEventCallback));
- metastore.registerClusterStatusListener(new ClusterStatusWatchListener(clusterEventCallback));
+ NodeStatusWatchListener nodeListener = new NodeStatusWatchListener(metastore, LOCAL_NODE, nodeEventCallback);
+ metastore.registerNodeStatusListener(nodeListener);
+ ClusterStatusWatchListener clusterListener = new ClusterStatusWatchListener(clusterEventCallback);
+ metastore.registerClusterStatusListener(clusterListener);
vaultManager.start();
metaStorageManager.start();
+ toStop = () -> {
+ nodeListener.stop();
+ vaultManager.stop();
+ try {
+ metaStorageManager.stop();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ };
+
assertThat("Watches were not deployed", metaStorageManager.deployWatches(), willCompleteSuccessfully());
}
+ @AfterEach
+ public void stop() {
+ toStop.run();
+ toStop = null;
+ }
+
@Test
public void clusterStatusTest() throws Exception {
String id = "id1";