Blogs

Java Monitor Pattern

In Java, each object provides an implicit monitor lock also called as intrinsic lock, which is used by its synchronized methods to ensure that only one thread can execute a critical section of code at a time. The critical section of code should allow only one thread to execute it at a time to avoid race conditions and is defined by synchronized methods. However, one disadvantage of intrinsic lock is that it offers only one mutex.

Topics: Java intrinsic lock Multithreading Java Monitor Pattern Technology

Limitations of intrinsic lock and solution

Java SE 5.0 introduced classes for locking called as Lock API. They are part of java.util.concurrent.locks package. Until then, only synchronized methods and synchronized blocks were available for locking.

Topics: ReentrantLock ReentrantReadWriteLock lock fairness Java ReadWriteLock Lock API intrinsic lock Multithreading monitor lock Technology

e-Zest Solutions is digital experience engineering company with facilities in the United States (Detroit & San Jose), Germany (Hannover), United Kingdom (London UK) and India (Pune) with global clientele. Our services include custom software development, offshore software development, UX consulting, BigData, Managed cloud Services (Azure & AWS), SharePoint consulting/Migration, Enterprise Java application development, Automated software testing services.