Java2Blog
  • Home
  • Core Java
  • Tutorials
    • Spring
    • Spring Boot
    • Spring MVC
    • Java 8
    • Hibernate
  • Categories
    • Interview Questions
    • Spring Frameworks
    • Core java
    • Python
    • C++
  • NM
close
import_contacts

Java Tutorials

  • Core Java
  • Java Interview questions
  • Java 8 Stream
  • Java interview programs
import_contacts

Data structure and algorithm

  • Data structure in java
  • Data structure interview questions
import_contacts

Spring tutorials

  • Spring tutorial
  • Spring boot tutorial
  • Spring MVC tutorial
  • Spring interview questions

Concurrent APIs

  • Difference between Runnable and Callable in java
    Concurrent APIs Multithreading Core Java interview Interview
    16 December

    Difference between Runnable and Callable in java

    Runnable and Callable interface both are used in the multithreading environment.Callable is available in java.util.concurrent.Callable package and Runnable in java.lang.Thread. Difference between Runnable and Callable interface in java Runnable was introduced in java 1.0 version While Callable is an extended version of Runnable and introduced in java 1.5 to address the limitation of Runnable. Runnable […]

    Read More
  • Java Exchanger example
    Concurrent APIs Multithreading
    06 January

    Java Exchanger example

    Exchanger class is introduced with java 1.5 with other classes such ConcurrentHashMap, CountDownLatch, Semaphores. Exchanger class is used to exchange object between two threads. Exchanger simply waits until two separate threads calls exchange method, when it happens, it exchanges data supplied by threads.Two threads can pair and swap objects between them. Exchanger class may be useful […]

    Read More
  • Java Semaphore example
    Concurrent APIs Multithreading Core Java interview Interview
    23 December

    Java Semaphore example

    In this tutorial, we are going to see about Semaphore in java. Semaphore is a class in java.util.concurrent package introduced in JDK 5. Semaphore basically maintains a set of permits, so there are two methods which are mainly used for semaphore. acquire release acquire() method is used to get a permit and if no. of […]

    Read More
  • Difference between CountDownLatch and CyclicBarrier
    Concurrent APIs Multithreading Core Java interview Interview
    11 July

    Difference between CountDownLatch and CyclicBarrier in java

    In this post, we will see difference between CountDownLatch and CyclicBarrier in java. Lets first see similarities among them. Both wait for specific number of threads or tasks to finish. Lets see differences between CountDownLatch and CyclicBarrier. CountDownLatch vs CyclicBarrier Parameter CountDownLatch CyclicBarrier Reuse It can not be reused once count reaches 0 It can […]

    Read More
  • Java CyclicBarrier Example
    Concurrent APIs Multithreading Core Java interview Interview
    17 May

    Java CyclicBarrier Example

    In this post, we will see about CyclicBarrier in java. CyclicBarrier was introduced in Java 5 with other concurrency utils such as CountDownLatch, ConcurrentHashMap and BlockingQueue. CyclicBarrier is synchronized aid which allows set of threads to wait for each other at common barrier points.It is called cyclic because it can be reused once waiting threads […]

    Read More
  • CountDownLatch in java
    Concurrent APIs Multithreading Core Java interview Interview
    08 August

    CountDownLatch in java

    As per java docs, CountDownLatch is synchronisation aid that allows one or more threads to wait until set of operations being performed in other threads completes.

    Read More
  • ConcurrentHashMap in java
    Concurrent APIs Multithreading Core Java interview Interview
    26 November

    ConcurrentHashMap in java

    ConcurrentHashMap was introduced in Java 5 with other concurrency utils such as CountDownLatch, CyclicBarrier and BlockingQueue. ConcurrentHashMap in java is very similar to HashTable but it provides better concurrency level. You might know , you can synchonize HashMap using Collections.synchronizedMap(Map). So what is difference between ConcurrentHashMap and Collections.synchronizedMap(Map)In case of Collections.synchronizedMap(Map), it locks whole HashTable […]

    Read More
  • Java ReentrantReadWriteLock Example
    Concurrent APIs Multithreading Core Java interview Interview
    27 April

    Java ReentrantReadWriteLock Example

    In this tutorial, we will see ReentrantReadWriteLock Example. ReentrantReadWriteLock supports semantics of ReentrantLock and also ReadWriteLock. ReadWriteLock has two locks, one for read and one for write. Request for read lock from multiple threads can be acquired if there is no write request. If there is a write request, no other thread will be able to […]

    Read More
  • Java ExecutorCompletionService
    Concurrent APIs Multithreading Core Java interview Interview
    09 June

    Java ExecutorCompletionService

    In this post, we will see about Java ExecutorCompletionService example. ExecutorCompletionService class implements CompletionService. This class returns Future object in completion order. Why you may need to use ExecutorCompletionService: Let’s understand with the help of scenario: Let’s say you have 5 tasks, you submit it to the executors and you want to perform some operation as soon […]

    Read More
  • 1
  • 2
  • Nextkeyboard_arrow_right

Newsletter


Let’s be Friends

  • Facebook
  • Twitter
  • LinkedIn

© 2020 Java2Blog