INT-2511 Change Default Socket Timeout

Previously, when a client connection factory was used by
both an inbound and outbound adapter, the socket timeout
defaulted to 10 seconds.

This was inappropriate because, often, collaborating
channel adapters are used for aysnchronous messaaging and,
even when used for request/response, it is generatlly not
appropriate to timeout the socket due to a lack of recent
send activity.
This commit is contained in:
Gary Russell
2012-04-14 11:04:27 -04:00
committed by Oleg Zhurakousky
parent 7177764a64
commit 409cc95607
3 changed files with 79 additions and 34 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.ip.tcp.connection;
import java.net.Socket;
import java.net.SocketException;
/**
* Abstract class for client connection factories; client connection factories
@@ -73,20 +72,6 @@ public abstract class AbstractClientConnectionFactory extends AbstractConnection
if (listener != null) {
connection.registerListener(listener);
}
if (listener != null || this.isSingleUse()) {
if (this.getSoTimeout() < 0) {
try {
/* Default so-timeout, when we have a collaborating inbound adapter,
* may go to infinity in a future release; currently it's 10 seconds.
* While it makes sense in a request/reply scenario, it doesn't
* really for completely asynchronous communication between peers.
*/
socket.setSoTimeout(DEFAULT_REPLY_TIMEOUT);
} catch (SocketException e) {
logger.error("Error setting default reply timeout", e);
}
}
}
TcpSender sender = this.getSender();
if (sender != null) {
connection.registerSender(sender);