From 26bfc2874623f7017acd1bdadbd3b41be04f78a9 Mon Sep 17 00:00:00 2001 From: Reinhard Prechtl Date: Sun, 21 Jan 2018 18:46:49 +0100 Subject: [PATCH] Rename custom transport factory --- .../ClusteredInfinispanContainer.java | 4 ++-- ...TopologyStateTransferTransportFactory.java | 23 +++++++++++++++++++ ...TopologyStateTransferTransportFactory.java | 18 --------------- .../resources/infinispan-91x-clustered.xml | 2 -- 4 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 src/main/java/de/rpr/testcontainers/infinispan/transport/DisabledTopologyStateTransferTransportFactory.java delete mode 100644 src/main/java/de/rpr/testcontainers/infinispan/transport/NoTopologyStateTransferTransportFactory.java diff --git a/src/main/java/de/rpr/testcontainers/infinispan/ClusteredInfinispanContainer.java b/src/main/java/de/rpr/testcontainers/infinispan/ClusteredInfinispanContainer.java index 705d8b9..432523f 100644 --- a/src/main/java/de/rpr/testcontainers/infinispan/ClusteredInfinispanContainer.java +++ b/src/main/java/de/rpr/testcontainers/infinispan/ClusteredInfinispanContainer.java @@ -1,6 +1,6 @@ package de.rpr.testcontainers.infinispan; -import de.rpr.testcontainers.infinispan.transport.NoTopologyStateTransferTransportFactory; +import de.rpr.testcontainers.infinispan.transport.DisabledTopologyStateTransferTransportFactory; import org.infinispan.client.hotrod.impl.transport.TransportFactory; import org.testcontainers.containers.BindMode; @@ -38,7 +38,7 @@ public class ClusteredInfinispanContainer extends InfinispanContainer { */ @Override protected Optional> getTransportFactory() { - return Optional.of(NoTopologyStateTransferTransportFactory.class); + return Optional.of(DisabledTopologyStateTransferTransportFactory.class); } /** diff --git a/src/main/java/de/rpr/testcontainers/infinispan/transport/DisabledTopologyStateTransferTransportFactory.java b/src/main/java/de/rpr/testcontainers/infinispan/transport/DisabledTopologyStateTransferTransportFactory.java new file mode 100644 index 0000000..d007b41 --- /dev/null +++ b/src/main/java/de/rpr/testcontainers/infinispan/transport/DisabledTopologyStateTransferTransportFactory.java @@ -0,0 +1,23 @@ +package de.rpr.testcontainers.infinispan.transport; + +import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.SocketAddress; +import java.util.Collection; + +/** + * This is a subclass of the {@link TcpTransportFactory}. It overwrites the {@link TcpTransportFactory#updateServers(Collection, byte[], boolean)} + * in order to suppress the update of the cluster nodes, communicated back to the client during the Hotrod Topology State Transfer. + */ +public class DisabledTopologyStateTransferTransportFactory extends TcpTransportFactory { + + private static final Logger LOG = LoggerFactory.getLogger(DisabledTopologyStateTransferTransportFactory.class); + + @Override + public void updateServers(final Collection newServers, final byte[] cacheName, final boolean quiet) { + LOG.info("Receiving new Servers: {}. Ignoring...", newServers); + } + +} diff --git a/src/main/java/de/rpr/testcontainers/infinispan/transport/NoTopologyStateTransferTransportFactory.java b/src/main/java/de/rpr/testcontainers/infinispan/transport/NoTopologyStateTransferTransportFactory.java deleted file mode 100644 index 22affdb..0000000 --- a/src/main/java/de/rpr/testcontainers/infinispan/transport/NoTopologyStateTransferTransportFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.rpr.testcontainers.infinispan.transport; - -import org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.SocketAddress; -import java.util.Collection; - -public class NoTopologyStateTransferTransportFactory extends TcpTransportFactory { - - private static final Logger LOG = LoggerFactory.getLogger(NoTopologyStateTransferTransportFactory.class); - - @Override - public void updateServers(final Collection newServers, final byte[] cacheName, final boolean quiet) { - LOG.info("Receiving new Servers: {}. Ignoring...", newServers); - } -} diff --git a/src/test/resources/infinispan-91x-clustered.xml b/src/test/resources/infinispan-91x-clustered.xml index 0a8be33..bccbf15 100644 --- a/src/test/resources/infinispan-91x-clustered.xml +++ b/src/test/resources/infinispan-91x-clustered.xml @@ -169,9 +169,7 @@ - -