SGF-378 - SDG completely ignores the 'socket-read-timeout' attribute on the Gateway element nested in a GatewayHub.
This commit is contained in:
@@ -127,6 +127,7 @@ public class GatewayHubFactoryBean extends AbstractWANComponentFactoryBean<Gatew
|
||||
}
|
||||
|
||||
gateway.setSocketBufferSize(gatewayProxy.getSocketBufferSize());
|
||||
gateway.setSocketReadTimeout(gatewayProxy.getSocketReadTimeout());
|
||||
|
||||
if (gatewayProxy.getQueue() != null) {
|
||||
GatewayQueue queue = gatewayProxy.getQueue();
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GatewayProxy {
|
||||
|
||||
private Integer concurrencyLevel;
|
||||
private Integer socketBufferSize;
|
||||
//private Integer socketReadTimeout;
|
||||
private Integer socketReadTimeout;
|
||||
|
||||
private List<GatewayEndpoint> endpoints;
|
||||
private List<GatewayEventListener> listeners;
|
||||
@@ -100,7 +100,6 @@ public class GatewayProxy {
|
||||
return (socketBufferSize != null ? socketBufferSize : Gateway.DEFAULT_SOCKET_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
public void setSocketReadTimeout(final Integer socketReadTimeout) {
|
||||
this.socketReadTimeout = socketReadTimeout;
|
||||
}
|
||||
@@ -108,7 +107,6 @@ public class GatewayProxy {
|
||||
public Integer getSocketReadTimeout() {
|
||||
return (socketReadTimeout != null ? socketReadTimeout : Gateway.DEFAULT_SOCKET_READ_TIMEOUT);
|
||||
}
|
||||
*/
|
||||
|
||||
public static class GatewayEndpoint {
|
||||
|
||||
|
||||
@@ -90,6 +90,25 @@ public class GatewayHubNamespaceTest {
|
||||
|
||||
@Test
|
||||
public void testGatewayConfiguration() {
|
||||
// NOTE don't ask!!! From GemFire 7.0.2 source (GatewayImpl.setSocketReadTimeout(..)) ...
|
||||
/*
|
||||
public void setSocketReadTimeout(int socketReadTimeout)
|
||||
{
|
||||
synchronized (this.controlLock) {
|
||||
checkRunning();
|
||||
getLogger().warning(LocalizedStrings.GatewayImpl_GATEWAY_SOCKET_READ_TIMEOUT_DISABLED);
|
||||
// do nothing on purpose...
|
||||
// setSocketReadTimeout is now optional and this impl ignores it
|
||||
// setSocketReadTimeout was causing too many problems because customers
|
||||
// kept using too small of a value
|
||||
}
|
||||
*/
|
||||
// This was changed in GemFire 8 and 8.1 to respect the user specified value (argh!!!).
|
||||
|
||||
final int expectedSocketReadTimeout =
|
||||
(Boolean.getBoolean(GemfireTestApplicationContextInitializer.GEMFIRE_TEST_RUNNER_DISABLED)
|
||||
? Gateway.DEFAULT_SOCKET_READ_TIMEOUT : 75000);
|
||||
|
||||
assertNotNull("The 'TestGatewayHub' GatewayHub was not properly initialized!", gatewayHub);
|
||||
assertEquals("localhost", gatewayHub.getBindAddress());
|
||||
assertEquals("TestGatewayHub", gatewayHub.getId());
|
||||
@@ -112,7 +131,7 @@ public class GatewayHubNamespaceTest {
|
||||
assertEquals(8, gatewayOne.getConcurrencyLevel());
|
||||
assertEquals(Gateway.OrderPolicy.THREAD, gatewayOne.getOrderPolicy());
|
||||
assertEquals(65536, gatewayOne.getSocketBufferSize());
|
||||
//assertEquals(75000, gatewayOne.getSocketReadTimeout());
|
||||
assertEquals(expectedSocketReadTimeout, gatewayOne.getSocketReadTimeout());
|
||||
assertTrue(gatewayOne.getEndpoints() == null || gatewayOne.getEndpoints().isEmpty());
|
||||
|
||||
List<GatewayEventListener> gatewayEventListeners = gatewayOne.getListeners();
|
||||
|
||||
@@ -117,8 +117,9 @@ public class StubCache implements Cache {
|
||||
|
||||
private HashMap<String, Region> allRegions;
|
||||
|
||||
public StubCache(){
|
||||
public StubCache() {
|
||||
this.allRegions = new HashMap<String,Region>();
|
||||
this.gatewayHubs = new ArrayList<GatewayHub>();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -196,7 +196,7 @@ public class GatewayHubFactoryBeanTest {
|
||||
gatewayProxy.setOrderPolicy(" thReAD ");
|
||||
gatewayProxy.setQueue(gatewayQueue);
|
||||
gatewayProxy.setSocketBufferSize(16384);
|
||||
//gatewayProxy.setSocketReadTimeout(300);
|
||||
gatewayProxy.setSocketReadTimeout(300);
|
||||
|
||||
GatewayHub mockGatewayHub = mock(GatewayHub.class, "testDoInit.MockGatewayHub");
|
||||
|
||||
@@ -215,7 +215,6 @@ public class GatewayHubFactoryBeanTest {
|
||||
factoryBean.setBindAddress("10.124.210.42");
|
||||
factoryBean.setGateways(Arrays.asList(gatewayProxy));
|
||||
factoryBean.setManualStart(false);
|
||||
//factoryBean.setMaxConnections(50);
|
||||
factoryBean.setMaximumTimeBetweenPings(20480);
|
||||
factoryBean.setName(gatewayHubName);
|
||||
factoryBean.setPort(8484);
|
||||
@@ -225,7 +224,6 @@ public class GatewayHubFactoryBeanTest {
|
||||
|
||||
verify(mockGatewayHub, times(1)).setBindAddress(eq("10.124.210.42"));
|
||||
verify(mockGatewayHub, times(1)).setManualStart(eq(false));
|
||||
//verify(mockGatewayHub, times(1)).setMaxConnections(eq(50));
|
||||
verify(mockGatewayHub, times(1)).setMaximumTimeBetweenPings(eq(20480));
|
||||
verify(mockGatewayHub, times(1)).setSocketBufferSize(eq(4096));
|
||||
verify(mockGatewayHub, times(1)).setStartupPolicy(eq("primary"));
|
||||
@@ -238,7 +236,7 @@ public class GatewayHubFactoryBeanTest {
|
||||
verify(mockGateway, times(1)).addListener(same(mockGatewayListener));
|
||||
verify(mockGateway, times(1)).setOrderPolicy(eq(Gateway.OrderPolicy.THREAD));
|
||||
verify(mockGateway, times(1)).setSocketBufferSize(eq(gatewayProxy.getSocketBufferSize()));
|
||||
//verify(mockGateway, times(1)).setSocketReadTimeout(eq(gatewayProxy.getSocketReadTimeout()));
|
||||
verify(mockGateway, times(1)).setSocketReadTimeout(eq(gatewayProxy.getSocketReadTimeout()));
|
||||
verify(mockGateway, times(1)).getQueueAttributes();
|
||||
verify(mockGatewayQueueAttributes, times(1)).setAlertThreshold(eq(gatewayQueue.getAlertThreshold()));
|
||||
verify(mockGatewayQueueAttributes, times(1)).setBatchConflation(eq(gatewayQueue.getEnableBatchConflation()));
|
||||
@@ -327,7 +325,7 @@ public class GatewayHubFactoryBeanTest {
|
||||
gatewayProxy.setOrderPolicy(" thREAD ");
|
||||
gatewayProxy.setQueue(gatewayQueue);
|
||||
gatewayProxy.setSocketBufferSize(4096);
|
||||
//gatewayProxy.setSocketReadTimeout(60);
|
||||
gatewayProxy.setSocketReadTimeout(60);
|
||||
|
||||
GatewayHub mockGatewayHub = mock(GatewayHub.class, "testGatewayQueueWithOverflowNoPersistence.MockGatewayHub");
|
||||
|
||||
@@ -357,7 +355,7 @@ public class GatewayHubFactoryBeanTest {
|
||||
verify(mockGatewayHub, times(1)).addGateway(eq(gatewayProxy.getId()), eq(gatewayProxy.getConcurrencyLevel()));
|
||||
verify(mockGateway, times(1)).setOrderPolicy(eq(Gateway.OrderPolicy.THREAD));
|
||||
verify(mockGateway, times(1)).setSocketBufferSize(eq(gatewayProxy.getSocketBufferSize()));
|
||||
//verify(mockGateway, times(1)).setSocketReadTimeout(eq(gatewayProxy.getSocketReadTimeout()));
|
||||
verify(mockGateway, times(1)).setSocketReadTimeout(eq(gatewayProxy.getSocketReadTimeout()));
|
||||
verify(mockGatewayQueueAttributes, times(1)).setAlertThreshold(gatewayQueue.getAlertThreshold());
|
||||
verify(mockGatewayQueueAttributes, times(1)).setBatchConflation(gatewayQueue.getEnableBatchConflation());
|
||||
verify(mockGatewayQueueAttributes, times(1)).setBatchSize(gatewayQueue.getBatchSize());
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
<gfe:gateway-hub id="TestGatewayHub" bind-address="localhost" manual-start="true" max-time-between-pings="5000"
|
||||
port="45123" socket-buffer-size="16384" startup-policy="primary">
|
||||
<gfe:gateway gateway-id="gateway1" concurrency-level="8" order-policy="thread" socket-buffer-size="65536">
|
||||
<!-- socket-read-timeout="75000">-->
|
||||
<gfe:gateway gateway-id="gateway1" concurrency-level="8" order-policy="thread" socket-buffer-size="65536"
|
||||
socket-read-timeout="75000">
|
||||
<gfe:gateway-listener>
|
||||
<bean class="org.springframework.data.gemfire.config.GatewayHubNamespaceTest.TestGatewayListener" p:name="ListenerOne"/>
|
||||
<ref bean="ListenerTwo"/>
|
||||
|
||||
Reference in New Issue
Block a user