INT-3449: TCP: read-delay for XML Configuration
JIRA: https://jira.spring.io/browse/INT-3449 Doc Polishing
This commit is contained in:
committed by
Gary Russell
parent
e43671feb9
commit
c309b031f8
@@ -107,6 +107,8 @@ public class TcpConnectionFactoryFactoryBean extends AbstractFactoryBean<Abstrac
|
||||
|
||||
private volatile boolean applySequence;
|
||||
|
||||
private volatile long readDelay;
|
||||
|
||||
private volatile TcpSSLContextSupport sslContextSupport;
|
||||
|
||||
private volatile TcpSocketSupport socketSupport = new DefaultTcpSocketSupport();
|
||||
@@ -189,6 +191,7 @@ public class TcpConnectionFactoryFactoryBean extends AbstractFactoryBean<Abstrac
|
||||
factory.setBeanName(this.beanName);
|
||||
factory.setTcpSocketSupport(this.socketSupport);
|
||||
factory.setApplicationEventPublisher(this.applicationEventPublisher);
|
||||
factory.setReadDelay(this.readDelay);
|
||||
}
|
||||
|
||||
private void setServerAttributes(AbstractServerConnectionFactory factory) {
|
||||
@@ -470,6 +473,10 @@ public class TcpConnectionFactoryFactoryBean extends AbstractFactoryBean<Abstrac
|
||||
this.applySequence = applySequence;
|
||||
}
|
||||
|
||||
public void setReadDelay(long readDelay) {
|
||||
this.readDelay = readDelay;
|
||||
}
|
||||
|
||||
public void setSslContextSupport(TcpSSLContextSupport sslContextSupport) {
|
||||
Assert.notNull(sslContextSupport, "TcpSSLConstextSupport may not be null");
|
||||
this.sslContextSupport = sslContextSupport;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package org.springframework.integration.ip.config;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
@@ -90,6 +91,7 @@ public class TcpConnectionFactoryParser extends AbstractBeanDefinitionParser {
|
||||
IpAdapterParserUtils.SOCKET_SUPPORT);
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element,
|
||||
IpAdapterParserUtils.MAPPER);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "read-delay");
|
||||
|
||||
return builder.getBeanDefinition();
|
||||
}
|
||||
|
||||
@@ -436,7 +436,6 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
return readDelay;
|
||||
}
|
||||
|
||||
// TODO: Expose on the namespace in 4.1 ?
|
||||
/**
|
||||
* The delay (in milliseconds) before retrying a read after the previous attempt
|
||||
* failed due to insufficient threads. Default 100.
|
||||
|
||||
@@ -675,6 +675,15 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="read-delay" type="xsd:string" default="100">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The delay (in milliseconds) before retrying a read after the previous attempt
|
||||
failed due to insufficient threads. Default 100.
|
||||
Only applies when 'using-nio' is true.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
host="localhost"
|
||||
lookup-host="false"
|
||||
apply-sequence="false"
|
||||
read-delay="10000"
|
||||
/>
|
||||
|
||||
<ip:tcp-outbound-channel-adapter id="testOutTcpNio"
|
||||
@@ -430,4 +431,4 @@
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="eventErrors" />
|
||||
</beans>
|
||||
</beans>
|
||||
|
||||
@@ -451,6 +451,7 @@ public class ParserUnitTests {
|
||||
assertEquals(125, tcpOutEndpoint.getPhase());
|
||||
assertFalse((Boolean) TestUtils.getPropertyValue(
|
||||
TestUtils.getPropertyValue(cfC1, "mapper"), "applySequence"));
|
||||
assertEquals(10000L, TestUtils.getPropertyValue(cfC1, "readDelay"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -466,6 +467,7 @@ public class ParserUnitTests {
|
||||
assertEquals(126, tcpInboundGateway1.getPhase());
|
||||
assertFalse((Boolean) TestUtils.getPropertyValue(
|
||||
TestUtils.getPropertyValue(cfS2, "mapper"), "applySequence"));
|
||||
assertEquals(100L, TestUtils.getPropertyValue(cfS2, "readDelay"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -116,7 +116,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
* Specify whether the URI should be encoded after any <code>uriVariables</code>
|
||||
* are expanded and before sending the request. The default value is <code>true</code>.
|
||||
* @param encodeUri true if the URI should be encoded.
|
||||
* @see org.springframework.web.util.UriComponentsBuilder.
|
||||
* @see org.springframework.web.util.UriComponentsBuilder
|
||||
* @since 4.1
|
||||
*/
|
||||
public void setEncodeUri(boolean encodeUri) {
|
||||
|
||||
@@ -1035,7 +1035,7 @@
|
||||
pools for the IO and assembly operations.
|
||||
</para>
|
||||
<para>
|
||||
The framework providers a
|
||||
The framework provides a
|
||||
<classname>CompositeExecutor</classname>, which allows the configuration
|
||||
of two distinct executors; one for performing IO operations, and
|
||||
one for message assembly. In this environment, an IO thread can never
|
||||
@@ -1046,7 +1046,9 @@
|
||||
<classname>AbortPolicy</classname> (ABORT when using <code><task></code>).
|
||||
When an IO cannot be completed, it is deferred for a short time and
|
||||
retried continually until it can be completed and an assembler
|
||||
allocated.
|
||||
allocated. By default, the delay is 100ms but it can be changed using the
|
||||
<code>readDelay</code> property on the connection factory (<code>read-delay</code>
|
||||
when configuring with the XML namespace).
|
||||
</para>
|
||||
<para>
|
||||
Example configuration of the composite executor is shown below.
|
||||
@@ -1482,6 +1484,15 @@ private CompositeExecutor compositeExecutor() {
|
||||
<entry></entry>
|
||||
<entry>See <xref linkend="ssl-tls"/> </entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>read-delay</entry>
|
||||
<entry>Y</entry>
|
||||
<entry>Y</entry>
|
||||
<entry>long > 0</entry>
|
||||
<entry>The delay (in milliseconds) before retrying a read after the previous attempt
|
||||
failed due to insufficient threads. Default 100.
|
||||
Only applies if <code>using-nio</code> is <code>true</code>.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user