我可以调整什么来解决这个最大连接问题?有没有指定限制的方法? 这来自Spring Integration应用程序。
<int-ftp:outbound-channel-adapter id="matasLiveProdSdkOutbound"
channel="ftpOutboundChannel"
session-factory="ftpsSessionFactory"
charset="UTF-8"
auto-create-directory="true"
use-temporary-file-name="false"
remote-file-separator="/"
remote-directory-expression="${egnyte.remote.dir}"
mode="IGNORE">
</int-ftp:outbound-channel-adapter>
这是我得到的错误:
Caused by: org.springframework.messaging.MessagingException: Failed to execute on session; nested exception is java.lang.IllegalStateException: failed to create FTPClient
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:343)
at org.springframework.integration.ftp.session.FtpRemoteFileTemplate.doExecuteWithClient(FtpRemoteFileTemplate.java:51)
at org.springframework.integration.ftp.session.FtpRemoteFileTemplate.executeWithClient(FtpRemoteFileTemplate.java:47)
at org.springframework.integration.ftp.session.FtpRemoteFileTemplate.exists(FtpRemoteFileTemplate.java:62)
at org.springframework.integration.file.remote.RemoteFileTemplate.sendFileToRemoteDirectory(RemoteFileTemplate.java:435)
... 70 more
Caused by: java.lang.IllegalStateException: failed to create FTPClient
at org.springframework.integration.ftp.session.AbstractFtpSessionFactory.getSession(AbstractFtpSessionFactory.java:171)
at org.springframework.integration.ftp.session.AbstractFtpSessionFactory.getSession(AbstractFtpSessionFactory.java:41)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:332)
... 74 more
Caused by: javax.net.ssl.SSLException: 550 Cannot connect. You have reached maximum allowed simultaneous connections 7 per user.
编辑:添加CachingSessionFactory,就像Gary建议我一样......
@Bean
public CachingSessionFactory ftpsCachingSessionFactory(DefaultFtpsSessionFactory ftpsSessionFactory) {
CachingSessionFactory cachingSessionFactory = new CachingSessionFactory(ftpsSessionFactory, 5);
cachingSessionFactory.setSessionWaitTimeout(1000);
return cachingSessionFactory;
}
我已将ftps会话工厂包装在cachingSessionFactoy中。现在,当我从上面的ftp出站适配器引用这个bean时,我收到一个错误,告诉我bean必须是 AbstractFtpSessionFactory 类型。是否在FTP出站适配器中使用 FTPS 缓存会话工厂 - 如上所述?我找不到任何int-ftps命名空间来切换适配器。 spring-integration-ftp-4.1xsd预计会声明只接受 org.springframework.integration.ftp.session.DefaultFtpSessionFactory 。