Prevent two copies of a cron job from running simultaneously. flock takes an FD to a lock file; if the lock is held, the second invocation exits immediately.
`object` declares a thread-safe lazy singleton. Built into the language — no `private constructor + getInstance()` boilerplate. Also: anonymous `object : Interface { … }` for one-shot instances.
A reusable trait that turns any class into a lazily-instantiated singleton with a single ::instance() accessor. Throws on clone/wakeup to prevent accidental duplication.
Lazily construct an expensive object exactly once, with TypeScript inferring the return type from the factory. Cleaner than the class-trait singleton pattern for module-scoped state.
`enum` with a single value is the simplest correct singleton implementation: lazy, thread-safe, serialization-safe, reflection-safe. Joshua Bloch's recommendation in Effective Java.