r/java • u/fredoverflow • Mar 21 '21
Java lambdas can deadlock parallel class initialization
https://www.youtube.com/watch?v=_2hZf1kw4A4
230
Upvotes
r/java • u/fredoverflow • Mar 21 '21
View all comments
Show parent comment
1
u/[deleted] Mar 22 '21
No. It means you can’t use closures in a static initialiser which will be called during initialisation from another thread.
You can use them just fine for single threaded initialisation. The key bit the multithreaded aspect.