Rename custom transport factory

This commit is contained in:
Reinhard Prechtl 2018-01-21 18:46:49 +01:00
parent 097862b30a
commit 26bfc28746
4 changed files with 25 additions and 22 deletions

View file

@ -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<Class<? extends TransportFactory>> getTransportFactory() {
return Optional.of(NoTopologyStateTransferTransportFactory.class);
return Optional.of(DisabledTopologyStateTransferTransportFactory.class);
}
/**

View file

@ -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<SocketAddress> newServers, final byte[] cacheName, final boolean quiet) {
LOG.info("Receiving new Servers: {}. Ignoring...", newServers);
}
}

View file

@ -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<SocketAddress> newServers, final byte[] cacheName, final boolean quiet) {
LOG.info("Receiving new Servers: {}. Ignoring...", newServers);
}
}

View file

@ -169,9 +169,7 @@
</subsystem>
<subsystem xmlns="urn:infinispan:server:endpoint:9.0">
<hotrod-connector socket-binding="hotrod" cache-container="clustered">
<topology-state-transfer lazy-retrieval="false" lock-timeout="1000" replication-timeout="5000"/>
</hotrod-connector>
<rest-connector socket-binding="rest" cache-container="clustered">
<authentication security-realm="ApplicationRealm" auth-method="BASIC"/>