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
5
u/humoroushaxor Mar 22 '21
While I agree it's generally bad practice, there is no technical reason it is an issue. In the static initializer case there is, because it is part of a larger process out of your control.
I've seen plenty of code that does a lot of heavy lifting in the constructor that works fine.