Skip to content

Commit 9c04db4

Browse files
committed
Revert "GH-9796: Fix SftpSession.write() for concurrency"
This reverts commit e73c3f2.
1 parent 5529e71 commit 9c04db4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2025 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,7 +45,6 @@
4545
import org.apache.sshd.common.util.security.SecurityUtils;
4646
import org.apache.sshd.sftp.client.SftpClient;
4747
import org.apache.sshd.sftp.client.SftpErrorDataHandler;
48-
import org.apache.sshd.sftp.client.SftpMessage;
4948
import org.apache.sshd.sftp.client.SftpVersionSelector;
5049
import org.apache.sshd.sftp.client.impl.AbstractSftpClient;
5150
import org.apache.sshd.sftp.client.impl.DefaultSftpClient;
@@ -439,7 +438,7 @@ public void destroy() throws Exception {
439438
*/
440439
protected class ConcurrentSftpClient extends DefaultSftpClient {
441440

442-
private final Lock sftpWriteLock = new ReentrantLock();
441+
private final Lock sendLock = new ReentrantLock();
443442

444443
protected ConcurrentSftpClient(ClientSession clientSession, SftpVersionSelector initialVersionSelector,
445444
SftpErrorDataHandler errorDataHandler) throws IOException {
@@ -448,15 +447,13 @@ protected ConcurrentSftpClient(ClientSession clientSession, SftpVersionSelector
448447
}
449448

450449
@Override
451-
public SftpMessage write(int cmd, Buffer buffer) throws IOException {
452-
this.sftpWriteLock.lock();
450+
public int send(int cmd, Buffer buffer) throws IOException {
451+
this.sendLock.lock();
453452
try {
454-
SftpMessage sftpMessage = super.write(cmd, buffer);
455-
sftpMessage.waitUntilSent();
456-
return sftpMessage;
453+
return super.send(cmd, buffer);
457454
}
458455
finally {
459-
this.sftpWriteLock.unlock();
456+
this.sendLock.unlock();
460457
}
461458
}
462459

0 commit comments

Comments
 (0)