Latest Posts

Java Callable Future Example

Java Callable and Future are used a lot in multithreaded programming. In last few posts, we learned a lot about java threads but sometimes we wish that a thread could return some value that we….

Multithreading in Java

Multithreading in Java is a very important topic. I have written a lot about Threads in Java. Java Thread is a lightweight process that executes some task. Java provides multithreading support with the Thread class….

Java ThreadLocal Example

Java ThreadLocal is used to create thread local variables. We know that all threads of an Object share it’s variables, so the variable is not thread safe. We can use synchronization for thread safety but….

Daemon Thread in Java

Daemon thread in java can be useful to run some tasks in background. When we create a thread in java, by default it’s a user thread and if it’s running JVM will not terminate the….

Thread Pool In Java

ThreadPoolExecutor – Java Thread Pool Example

Java thread pool manages the pool of worker threads. It contains a queue that keeps tasks waiting to get executed. We can use ThreadPoolExecutor to create thread pool in Java. Java thread pool manages the….

Thread Safety in Java

Thread Safety in Java is a very important topic. Java provides multi-threaded environment support using Java Threads, we know that multiple threads created from same Object share object variables and this can lead to data….

Deadlock in Java Example

Deadlock in java is a programming situation where two or more threads are blocked forever. Java deadlock situation arises with at least two threads and two or more resources. Here I have written a simple….

Java Thread Dump – VisualVM, jstack, kill -3, jcmd

Java Thread dump is list of all the threads active in the JVM. Java Thread Dump Java thread dump is very helpful in analyzing bottlenecks in the application and deadlock situations. Here we will learn….

Java Timer TimerTask Example

Java java.util.Timer is a utility class that can be used to schedule a thread to be executed at certain time in future. Java Timer class can be used to schedule a task to be run….

Thread Life Cycle in Java – Thread States in Java

Understanding Thread Life Cycle in Java and Thread States are very important when you are working with Threads and programming for multithreaded environment. From our last tutorial, we can create a java thread class by….

Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages