Skip to content

Conversation

@noxvost
Copy link
Contributor

@noxvost noxvost commented Dec 12, 2025

Synchronized blocks pin the virtual thread under JDK21+ to physical thread. It is better to avoid such pinning in I/O bound operations so VirtualThread planner can do its job

synchronized blocks pin the virtual thread under JDK21+ to physical thread. It is better to avoid such pinning in I/O bound operations so VirtualThread planner can do its job
@tomaswolf
Copy link
Member

There are a lot more synchronized blocks and methods in Apache MINA sshd. I'm fine with replacing these two; I would object to replacing all uses of synchronized by re-entrant locks.

If thread pinning is a problem, I think you could migrate to Java >= 24, which should have JEP-491 implemented: using synchronized together with virtual threads should not be a problem anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants