Commit 4eccf49
committed
GH-855: single SftpClient in SftpFileSystem
Drop the SftpClient pool and use a single thread-safe SftpClient per
SftpFileSystem. The SftpClient is closed when the file system is closed.
If the server side should close the channel, operations using this
client may fail, but a server should not close channels unless there is
no traffic. If a channel is closed by the server because it is idle, the
SftpFileSystem will re-create a new SftpClient, thus opening a new
channel, on the next operation.
It is possible that a server decides to close a previously idle channel
just in the moment the client-side wants to use that channel for a new
operation. The new operation would then fail. But this possibility has
always existed in all previous versions of the SftpFileSystem code.
The main advantage of using a single SftpClient is that all SFTP
operations are done in the same channel. This can be important with
servers that restrict the number of concurrently open channels per SSH
session.1 parent c69cd0c commit 4eccf49
4 files changed
Lines changed: 136 additions & 228 deletions
File tree
- sshd-sftp/src
- main/java/org/apache/sshd/sftp
- client/fs
- test/java/org/apache/sshd/sftp/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
79 | | - | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
| 84 | + | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | | - | |
| 94 | + | |
| 95 | + | |
91 | 96 | | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
0 commit comments