concurrent
-
Java 8 Concurrency Tutorial
This article is about concurrency and parallel processing features in Java update 8. It is necessary to mention that concurrency…
Read More » -
Java CountDownLatch Example
In this example we will discuss about the class java.util.concurrent.CountDownLatch. java.util.concurrent.CountDownLatch is a synchronization mechanism that allows one or more…
Read More » -
Java BlockingQueue Example
In this example we will discuss about java.util.concurrent.BlockingQueue interface. java.util.concurrent.BlockingQueue was added in Java 1.5 along with all the other…
Read More » -
Java ExecutorService Example – Tutorial
Java ExecutorService is an interface that extends Executor class and represents an asynchronous execution. Executor service provides us mechanisms to…
Read More » -
CountDownLatch example of a more general wait/notify mechanism
In this example we shall show you how to create a CountDownLatch of a more general wait/notify mechanism. We have…
Read More » -
Synchronous Queue example to execute commands
private BlockingQueue workQueue = new LinkedBlockingQueue(); private Map commandQueueMap = new ConcurrentHashMap(); public SynchronousQueue addCommand(Command command) { SynchronousQueue queue =…
Read More » -
Blocking Queue example of limited connection pool
private BlockingQueue<Connection> pool = new ArrayBlockingQueue<Connection>(10); private AtomicInteger connCount = new AtomicInteger(); public Connection getConnection() { Connection conn = pool.poll(5,…
Read More » -
Blocking Queue example to execute commands
import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; private BlockingQueue<Command> workQueue = new LinkedBlockingQueue<Command>(); public void addCommand(Command command) { workQueue.offer(command); } public Object call()…
Read More » -
Reentrant Lock example of a task runner
With this example we are going to demonstrate how to implement a ReentrantLock of a task runner. The ReentrantLock is…
Read More » -
Reentrant ReadWriteLock example of value calculator
This is an example of how to use a ReentrantReadWriteLock of a value calculator. We have implemented a method that…
Read More »