Link Details

Link 938411 thumbnail
User 884233 avatar

By screener
via javarevisited.blogspot.sg
Published: Mar 14 2013 / 21:32

Prior to Java 1.5, synchronized and volatile keyword were only way to coordinate access to shared variable, but Java 5 provides another alternative in terms of ReentrantLock. ReentrantLock offers features, which synchronized keyword lacks and which are essential to building non blocking algorithm, such as trying for lock without getting blocked, trying for lock interruptibly and trying lock with timeout. Though ReentrantLock offer same ordering and visibility guarantee, it comes with a danger, programmer need to take care of acquisition and release of lock, which if not difficult but can lead to subtle bugs if programmer forget to release lock in finally block.
  • 7
  • 0
  • 1952
  • 1389

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (0)



    Reactive Programming with Akka
    Written by: Ryan Knight
    Featured Refcardz: Top Refcardz:
    1. Design Patterns
    2. OO JS
    3. Cont. Delivery
    4. Java Performance
    5. HTML5 Mobile
    1. Java Performance
    2. Node.js
    3. Debugging JavaScript
    4. Java
    5. Java Concurrency