LinkedTransferQueue in Java With Examples

LinkedTransferQueue in Java is an implementation of the TransferQueue interface and is part of java.util.concurrent package. It was added in Java 7. TransferQueue interface in Java TransferQueue interface which extends BlockingQueue interface adds the capability where producers may wait for consumers to receive elements. In BlockingQueue implementations like ArrayBlockingQueue, PriorityBlockingQueue…

Continue reading

SynchronousQueue in Java With Examples

SynchronousQueue in Java is an implementation of BlockingQueue interface and is part of java.util.concurrent package. SynchronousQueue in Java is different from other BlockingQueue implementations like ArrayBlockingQueue and PriorityBlockingQueue because a synchronous queue does not have any internal capacity, not even a capacity of one. So, each insert operation in SynchronousQueue…

Continue reading

ReentrantReadWriteLock in Java With Examples

In this post we’ll see the usage of java.util.concurrent.locks.ReadWriteLock interface and its implementing class ReentrantReadWriteLock in Java with examples. Table of contents ReadWriteLock in Java Concurrency Benefits of ReadWriteLock ReentrantReadWriteLock in Java Concurrency Java ReentrantReadWriteLock constructors ReentrantReadWriteLock example in Java ReentrantReadWriteLock Properties ReadWriteLock in Java Concurrency ReadWriteLock as the name…

Continue reading

ReentrantLock in Java With Examples

ReentrantLock in Java is part of java.util.concurrent.locks package with in the Java concurrency API added in Java 5 which also has other classes like ConcurrentHashMap, CountDownLatch. ReentrantLock class in Java implements java.util.concurrent.locks.Lock interface and provide many locking operations. Table of contents ReentrantLock in Java Concurrency Why call it a ReentrantLock…

Continue reading