简体   繁体   中英

Async sftp file transfer with Jsch?

Is there a way to do asynchronous sftp file transfer with Jsch without having to manage your own threads?

I see there is a SftpProgressMonitor to monitor the progress but it just provides a callback.

I'm looking for something similar to Java's AsynchronousFileChannel write method:

public abstract Future write(ByteBuffer src, long position)

Which library provides async sftp transfer?

I solved the problem performing the transfer asynchronously using CompletableFuture (take a look at runAsync and supplyAsync methods).

The class also offers methods to combine or chain multiple futures together with methods like: CompletableFuture.allOf , CompletableFuture.thenCompose , etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM