concurrency - Trade offs between using Java's built in concurency mechanism versus Utilities provided in java.util.concurrent -


What are the trade-offs between Java's utility versus usilities (for example, in reententials) in the form of Java. Synchronize :

  • Obviously, just using the synchronized block (or method) is easier than the syntax side, and you can not forget the unlock () step.

    lock :

    • With clear lock objects, on the other hand, you Non-Nested Protected Blocks - As you repeat on a linked list, you always want to lock the next list element and only later this unlock can be preceded.

    • Allows blocking a lock object blocker, blocks interceptors and blocks non-blocking to obtain lock, while a synchronized block is blocked only non-interrupt Allows

    • Again, other lock implementations allow different locking strategies (like ReadWriteLock).

Comments