activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2774 Remove the divert transformer on divert destroying
Date Thu, 21 May 2020 20:29:04 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 3bcea4e  ARTEMIS-2774 Remove the divert transformer on divert destroying
     new 0106e26  This closes #3145
3bcea4e is described below

commit 3bcea4e78e4d98e4e7a7c8aefd6378c6716e84cb
Author: brusdev <bruscinodf@gmail.com>
AuthorDate: Thu May 21 21:56:17 2020 +0200

    ARTEMIS-2774 Remove the divert transformer on divert destroying
---
 .../org/apache/activemq/artemis/core/server/ServiceRegistry.java     | 2 ++
 .../apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java | 4 ++++
 .../activemq/artemis/core/server/impl/ServiceRegistryImpl.java       | 5 +++++
 .../apache/activemq/artemis/tests/integration/divert/DivertTest.java | 3 +++
 4 files changed, 14 insertions(+)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java
index 487bb62..32d2fcc 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java
@@ -98,6 +98,8 @@ public interface ServiceRegistry {
 
    void addDivertTransformer(String name, Transformer transformer);
 
+   void removeDivertTransformer(String name);
+
    /**
     * Get an instance of org.apache.activemq.artemis.core.server.transformer.Transformer
for a bridge
     *
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index 003e6e1..1f3413b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -2595,6 +2595,10 @@ public class ActiveMQServerImpl implements ActiveMQServer {
       }
 
       postOffice.removeBinding(name, null, true);
+
+      if (((DivertBinding)binding).getDivert().getTransformer() != null) {
+         getServiceRegistry().removeDivertTransformer(name.toString());
+      }
    }
 
    @Override
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java
index 7161a68..601c90c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServiceRegistryImpl.java
@@ -157,6 +157,11 @@ public class ServiceRegistryImpl implements ServiceRegistry {
    }
 
    @Override
+   public void removeDivertTransformer(String name) {
+      divertTransformers.remove(name);
+   }
+
+   @Override
    public Transformer getDivertTransformer(String name, TransformerConfiguration transformerConfiguration)
{
       Transformer transformer = divertTransformers.get(name);
 
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
index fb5dd81..3ee1049 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/divert/DivertTest.java
@@ -1461,5 +1461,8 @@ public class DivertTest extends ActiveMQTestBase {
       }
       assertNotNull(divert);
       assertEquals(transformer, divert.getTransformer());
+
+      server.destroyDivert(SimpleString.toSimpleString(DIVERT));
+      assertNull(serviceRegistry.getDivertTransformer(DIVERT, null));
    }
 }


Mime
View raw message