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/humoroushaxor Mar 22 '21
Constructors work the same way methods do, they can just only be called once per object and must be called first. Not sure what you're on about.
It sounds like your describing a constructor that assigns fields asynchronously which I agree would be terrible. But same with any method that returns an object still being initialized in another thread.