how to handle automatically synchronized blocks

Alan Bateman Alan.Bateman at oracle.com
Tue Aug 13 13:47:00 UTC 2019


On 13/08/2019 11:38, Cristian Lorenzetto wrote:
> I have a project with many synchronized blocks using fibers and threads .
> I was studing a way to solve this problem with fibers. Synchronized blocks
> now works just with threads. I found a solution but is a bit complex and
> long for a single developer.
> Essentially using instrumentation i change bytecode replacing the old
> synchonized block instruction with a block working also with fibers.
> No one developed a similr solution?
I think Rémi Forax was looking tooling too, I think to replace monitors 
with j.u.c. locks and probably Condition objects for using monitor 
wait/notify. You don't of course need to change all usage of monitors, 
it should only be the places where do you are doing blocking operations 
while holding a monitor. If you run with -Djdk.tracePinnedThreads=full 
(or "short") then it may help you identify the places where this arises.

-Alan


More information about the loom-dev mailing list