Files
spring-integration/spring-integration-sftp
Artem Bilan e73c3f22a0 GH-9796: Fix SftpSession.write() for concurrency
Fixes: #9796
Issue link: https://github.com/spring-projects/spring-integration/issues/9796

The `org.apache.sshd.sftp.client.impl.SftpOutputStreamAsync` is shared object for the `DefaultSftpClient`
and it cannot be used concurrently.

The guarded `send()` operation in the `ConcurrentSftpClient` is not enough
since `DefaultSftpClient.write()` is called directly from the `SftpOutputStreamAsync.internalFlush()`.
And this in the end is called from the `SftpSession.write()`

* Fix `DefaultSftpSessionFactory.ConcurrentSftpClient` to override the `write()` method instead.
Guard it with a `Lock` and call `sftpMessage.waitUntilSent();` to ensure that no concurrent access
to the underlying `SftpOutputStreamAsync`.

(cherry picked from commit 91f4fe48b6)
2025-01-28 17:17:30 +00:00
..
2016-05-03 11:55:55 -04:00