Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: i would not say that the integer overflow check was ommited for brevity, but rather that the burden has been shifted to the caller. i'm wondering how/where the key is initialized to 0?

...

Prefer using block synchronization instead of method synchronization when the method contains non-atomic operations that either do not require any synchronization or can use a more fine-grained locking scheme involving multiple internal private lock objects. Non-atomic operations can be decoupled from those that require synchronization and executed outside the synchronized block. The guideline CON04-J. Synchronize using an internal private final lock object has more details on using private internal lock objects and block synchronization.

...