Synchronized
Adjective · Development
Definitions
In Java, a keyword that acquires an intrinsic monitor lock on an object (or class) before executing a block or method, ensuring that only one thread at a time can enter any synchronized region guarded by the same lock. Broadly, it describes any resource protected by mutual exclusion.
In plain English: A way to mark code so that only one thread can run it at a time, preventing data corruption but potentially slowing things down.
Example: "Making the method synchronized fixed the race condition but tanked throughput — we need a finer-grained lock."