Thread concurrency in java

1- CountDownLatch
2-CyclicBarrier
3- Phaser
4-Exchanger
5-Semaphore
6-SynchronousQueue

It allows one or more threads to wait until a set of operations being performed in other threads are completed

C:\Users\sanjsingh>javap java.util.concurrent.CountDownLatch
public class java.util.concurrent.CountDownLatch {
public java.util.concurrent.CountDownLatch(int);
public void await() throws java.lang.InterruptedException;
public boolean await(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException;
public void countDown();
public long getCount();
public java.lang.String toString();
}

Modifier and Type Method and Description
void await()
Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted.

boolean await(long timeout, TimeUnit unit)
Causes the current thread to wait until the latch has counted down to zero, unless the thread is interrupted, or the specified waiting time elapses.

void countDown()
Decrements the count of the latch, releasing all waiting threads if the count reaches zero.

long getCount()
Returns the current count.

String toString()
Returns a string identifying this latch, as well as its state.

Java||Spring-Boot|| Micro services Application developer|| angular || INDIA