spring 集成中没有定义 SSL 握手超时的选项
no option to defined SSL handshake timeout in spring integration
我在我的一个应用程序中使用 spring 集成来与银行通信。在重负载下,我们收到错误 "org.springframework.messaging.MessagingException: SSL Handshaking taking too long"。银行要求我们将超时设置为 90 秒。
在查看 TcpNioSSLConnection class 的代码时,我发现 30 秒是硬编码的。
private HandshakeStatus waitForHandshakeData(SSLEngineResult result,
HandshakeStatus status) thr`enter code here`ows IOException {
try {
if (logger.isTraceEnabled()) {
logger.trace("Writer waiting for handshake");
}
if (!TcpNioSSLConnection.this.semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
throw new MessagingException("SSL Handshaking taking too long");
}
if (logger.isTraceEnabled()) {
logger.trace("Writer resuming handshake");
}
status = runTasksIfNeeded(result);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MessagingException("Interrupted during SSL Handshaking");
}
return status;
}
如果有任何方法可以增加 ssl 握手超时,请给我建议
下面是我的spring集成连接工厂配置
<int-ip:tcp-connection-factory id="client"
type="client" port="${cbs.third.party.port}" host="${cbs.third.party.host}"
single-use="true" using-nio="true" deserializer="javaDeserializer"
serializer="javaSerializer" ssl-context-support="sslContextSupport" task-executor="myTaskExecutor"/>
谢谢,
罗希特
目前无法配置该超时;我开了一个JIRA Issue.
您可以尝试将 use-nio
设置为 false
;除非您长时间打开大量套接字,否则通常不需要。
我在我的一个应用程序中使用 spring 集成来与银行通信。在重负载下,我们收到错误 "org.springframework.messaging.MessagingException: SSL Handshaking taking too long"。银行要求我们将超时设置为 90 秒。 在查看 TcpNioSSLConnection class 的代码时,我发现 30 秒是硬编码的。
private HandshakeStatus waitForHandshakeData(SSLEngineResult result,
HandshakeStatus status) thr`enter code here`ows IOException {
try {
if (logger.isTraceEnabled()) {
logger.trace("Writer waiting for handshake");
}
if (!TcpNioSSLConnection.this.semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
throw new MessagingException("SSL Handshaking taking too long");
}
if (logger.isTraceEnabled()) {
logger.trace("Writer resuming handshake");
}
status = runTasksIfNeeded(result);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MessagingException("Interrupted during SSL Handshaking");
}
return status;
}
如果有任何方法可以增加 ssl 握手超时,请给我建议
下面是我的spring集成连接工厂配置
<int-ip:tcp-connection-factory id="client"
type="client" port="${cbs.third.party.port}" host="${cbs.third.party.host}"
single-use="true" using-nio="true" deserializer="javaDeserializer"
serializer="javaSerializer" ssl-context-support="sslContextSupport" task-executor="myTaskExecutor"/>
谢谢, 罗希特
目前无法配置该超时;我开了一个JIRA Issue.
您可以尝试将 use-nio
设置为 false
;除非您长时间打开大量套接字,否则通常不需要。