Java Executor Framework Tutorial

The concurrency API in Java was introduced in Java 1.5 .Java Executor framework is used to run the Runnable objects without creating new threads and reusing the existing ones as creating threads is an expensive process. It simplifies the execution of tasks in asynchronous mode. ExecutorService An ExecutorService is created using Executors factory methods. The […]

ThreadPoolExecutor and ScheduledThreadPoolExecutor

ThreadPoolExecutor ThreadPoolExecutor implements ExecutorService .It executes each submitted tasks using one of its internally pooled threads.Thread pools provide improved performance when executing large number of asynchronous tasks.This class provides many adjustable parameters and extensibility hooks. But usually ExecutorFactory methods are used to create thread pool. You can configure the no of threads in the ThreadPoolExecutor […]

How to create Threads in Java

What is a Thread? A thread is a light weight process.Java provides built in support for multithreading. A multithreaded program contain several parts than can run concurrently. Each part is a thread which has a separate thread of execution. A thread exists within a process and a single process can contain multiple threads. Lifecycle of […]