apache / mina-sshd

Apache MINA sshd is a comprehensive Java library for client- and server-side SSH.
https://mina.apache.org/sshd-project/
Apache License 2.0
885 stars 358 forks source link

Adding Project Loom Support #480

Open dspangen opened 6 months ago

dspangen commented 6 months ago

Description

Hi, I noticed there are quite a few uses of spinlocks (synchronized usage) within mina. Are there any plans to replace these with ResourceLocks to prevent thread pinning (as discussed in JEP-444)? Without it, it's not reasonable to use mina with virtual threads in all cases.

Motivation

Scalability

Alternatives considered

No response

Additional context

No response

tomaswolf commented 5 months ago

No, there are currently no such plans. Also from JEP-444:

In a future release we may be able to remove the first limitation above, namely pinning inside synchronized.

Object monitors are a very useful language feature; replacing them all by ReentrantLocks will complicate the code and reduce its readability considerably and gives rise to new possibilities to make mistakes.

Apache MINA SSHD is built on the asynchronous I/O model; it's not clear to me how easy or complicated it might be to adapt it to virtual threads such that it actually benefits from them.