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 […]

Object Serialization – Saving Objects in Java

Serialization is the process of converting the state of an object into byte stream.After the object is serialized has been written into a file, it can be read from the file and deserialized that is bytes that represent the object and its data can be used to recreate the objects in memory. Writing Serialized Object […]

ConcurrentHashMap in Java

ConcurrentHashMap is an alternative to HashTable and synchronizedMap. It is used in multi threaded applications and provided better performance when compared to HashTable and synchronisedMap. ConcurrentHashMap Implementation In Java In concurrentHashMap we have new feature called concurrency level . The ConcurrentHashMap is divided into segments based on the concurrency level.We need to be careful while […]