ArrayBlockingQueue in Java

ArrayBlockingQueue in Java ArrayBlockingQueue is a class in Java that implements the BlockingQueue interface. It is a bounded BlockingQueue that stores elements internally in the form of an array. Hence it implements the FIFO concept(First In First Out) which means that the element that we insert first will be retrieved …

Read more

BlockingQueue interface in Java

BlockingQueue interface in Java BlockingQueue is an interface in Java that is part of the Java concurrency utility java.util.concurrent package. It is a queue implementation that blocks the thread during insertion and deletion operations. This means it blocks the thread when the queue has reached its maximum capacity during insert …

Read more

ScheduledExecutorService in Java

ScheduledExecutorService The ScheduledExecutorService interface in Java is a concurrency utility that is a subinterface of the ExecutorService. This interface is present in the java.util.concurrent package. Whenever we want to schedule a task or execute tasks periodically or after a fixed time period, we can use the ScheduledExecutorService interface. It is …

Read more

ExecutorService in Java

ExecutorService in Java is an interface that is part of the java.util.concurrent package. This Java concurrency utility helps to execute asynchronous tasks concurrently. Using the ExecutorService interface, we can separate the task creation and task execution process. It is a subinterface of the ExecutorFramework. In this tutorial, we will discuss …

Read more

Java Concurrency utilities

The java.util.concurrent package contains various Java concurrency utilities that provide various classes for multithreading. This package is present from Java 5 onwards. Prior to this, the user has to create their own utilities for developing concurrent applications. In this tutorial, we will see an overview of all the Java concurrency …

Read more

Deadlock in Java

What is the deadlock situation in Java? In a multithreading environment, there are many chances for a Java deadlock situation to occur. In this tutorial, we will see how to detect and avoid a deadlock situation in Java. A deadlock occurs when two threads wait for each other infinitely and …

Read more

Volatile keyword in Java

Volatile keyword in Java In a multithreading environment, there are several situations where multiple threads try to update the same shared variable. This means it can lead to concurrency issues in Java. To handle this and make it thread-safe, we can use the volatile keyword in Java to update the …

Read more

Inter thread communication in Java

Inter thread communication in Java Inter thread communication in Java or cooperation is the process of coordinating the communication between the synchronized threads. This means, when a new thread wants to enter the critical section, it pauses the currently executing thread to allow the new thread. In this way, if …

Read more

Thread synchronization in Java

Thread synchronization in Java Thread synchronization is an important concept in Java Multithreading. It is important to achieve thread-safety since in multithreading uses shared resources. We can implement thread-safety using synchronized block and method in Java. Synchronization ensures the control of multiple threads accessing the same resource by allowing only …

Read more

Translate ยป