Hi,
We've been using JSch for some use cases where scale and performance are a priority.
We've made some changes to the source code to improve the saleability of the software.
Rather than continue on a separate fork I thought I would see if you wanted the changes.
I attach two diffs (I can make patches if you'd prefer).
threading.diff
This diff contains a largish change that alters Jsch to allow it to support a different threading model. With the diff applied Jsch can be used from an external thread pool, and these threads can be attached/detached from Jsch leaving the socket open. This allows Jsch to have many connections open without each connection requiring its own thread. When idle this reduces the cost of the device connection to just the open socket and some memory. We are using this behaviour to cache device connections, and then only service the connection with a thread when we actually want to send or receive data from it.
synchronization.diff
This is a smaller/simpler change that improves a lot of the synchronization code to reduce contention. We were seeing a large amount of contention to critical sections when the number of open connections was sufficiently large. This change reworks the code to reduce the need for global synchronization. The only contentious change in the patch is a change to random which uses a thread local, this reduces contention at the cost of thread startup time and memory (we're using a thread pool so this is mitigated). You may want to make this an option (a different implementation of random) or just not apply it.
regards,
Gavin
Adding attachments via a different browser (didn't work in IE).