# Constructors Are Not Thread-Safe

DevFeed: [Constructors Are Not Thread-Safe](<https://devfeed.tech/articles/constructors-are-not-thread-safe-32220.md>)

Original publisher: [Read original article](<https://bruceeckel.com/2017/01/13/constructors-are-not-thread-safe/>)

Author: Bruce Eckel

Published: 2017-01-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [Bruce Eckel - Computing Thoughts](<https://devfeed.tech/sources/bruce-eckel-computing-thoughts.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Java](<https://devfeed.tech/topics/java.md>), [Java Language](<https://devfeed.tech/topics/java-language.md>)

Tags: [concurrency](<https://devfeed.tech/tags/concurrency.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [java](<https://devfeed.tech/tags/java.md>), [java-language](<https://devfeed.tech/tags/java-language.md>), [locking](<https://devfeed.tech/tags/locking.md>), [object](<https://devfeed.tech/tags/object.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threads](<https://devfeed.tech/tags/threads.md>)

## AI overview

This Java article explains why object construction is not automatically thread-safe. It examines shared mutable state, concurrent object creation, constructor arguments, synchronization, and factory methods as ways to avoid collisions and ensure safe construction.

## Source excerpt

When you imagine the construction process, it can be easy to think that it's thread-safe. After all, no one can even see the new object before it finishes initialization, so how could there be contention over that object? Indeed, the Java Language Specification (JLS) confidently states: "There is no practical need for a constructor to be synchronized, because it would lock the object under construction, which is normally not made available to other threads until all constructors for the object have completed their work.