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
  • Concurrent APIs Core Java interview Multithreading
    13 June

    Java Executor framework tutorial with example

    Java 5 has introduced new framework called Executor Framework for managing threads.We have already seen before how to create a thread. If you have noted, we need to create an object of thread class using new Thread(runnableObject), so we need to create thread object for each task.Imagine a situation where you have thousands of task […]

    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
  • Concurrent APIs Core Java interview Multithreading
    05 June

    Java newSingleThreadExecutor example

    In this tutorial, we will learn about Executor’s newSingleThreadExecutor factory method. In the last tutorial, I have shared an introduction to ThreadPoolExecutor. If you are not aware of concepts of ThreadPoolExecutor, you should go through that first. Executor’s newSingleThreadExecutor factory method : This method returns thread pool executor which executes one task at a time.If […]

    Read More
  • Concurrent APIs Core Java interview Multithreading
    29 May

    Java ScheduledThreadPoolExecutor Example

    There are multiple ways to schedule a task in java. We have already Java timer to schedule a task but the problem with timers task is that you can execute one task at a time.So if the current task takes longer subsequent job will be delayed. In this scenario, you can use Java ScheduledThreadPoolExecutor.This class […]

    Read More
  • Java FutureTask example
    Concurrent APIs Multithreading Core Java interview Interview
    28 May

    Java FutureTask example

    In this tutorial, we will see about Java FutureTask example. FutureTask class has been introduced in JDK 5 with Executor Framework. FutureTask class is the concrete implementation of the Future object and provides methods for start and cancel the task.It also provides method to see if the computation is done or not. We can query […]

    Read More
  • Concurrent APIs Core Java interview Multithreading
    20 May

    Java newFixedThreadPool Example

    In this tutorial, we will learn about Executor’s newFixedThreadPool factory method. In the last tutorial, I have shared an introduction to ThreadPoolExecutor. If you are not aware of concepts of ThreadPoolExecutor, you should go through that first. Executor’s newFixedThreadPool factory method : This method returns ThreadPoolExecutor whose maximum size(let’s say n threads) is fixed.If all […]

    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
  • 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
  • 1
  • 2
  • Nextkeyboard_arrow_right

Newsletter


Let’s be Friends

  • Facebook
  • Twitter
  • LinkedIn

© 2020-22 Java2Blog Privacy Policy