Another way of providing thread safety instead of synchronization can be accomplished by using classes from the java.util.concurrent.locks package.
It is similar to synchronization (lock on an Objects monitor) but using locks the locks can be released in a different order then obtaining them.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.