I'm struggle with cashed sftp session factory. Namely, I suffered from session unavailable because I used to many in my application. Currently I have one default non cashed session. Which writes file to sftp server but set up locks on them. Thus it can't be read by any other user. I'd like to avoid it. Perfectly, turn off lock after single file is uploaded. Is it possible ?
Test structure
When you deal with data transferring over the network, you need to be sure that you release resources you use do to that. For example be sure to close InputStream
after sending data to the SFTP. This is really not a framework responsibility to close it automatically. More over you may give us already not an InputStream
, but just plain byte[]
from it. That's only a reason I can think about locking-like behavior.