Skip to content
Advertisement

Tag: static

Thread safety of static blocks in Java

Let’s say I have some Java code: If a thread is initializing SomeClass’s Class object and is in the middle of initializing the values in the static block when a second thread wants to load SomeClass’s Class again, what happens to the static block? Does the second thread ignore it assuming it’s already initialized even though the first thread is

Advertisement