List/Grid Tag Archives: Concurrency

Implementing custom Future
Last time we learned the principles behind java.util.concurrent.Future<T>. We also discovered that Future<T> is typically returned by libraries or frameworks. But there ...

java.util.concurrent.Future basics
Hereby I am starting a series of articles about future concept in programming languages (also known as promises or delays) with a working title: Back to the Future. Futures are very ...

Java concurrency: the hidden thread deadlocks
Most Java programmers are familiar with the Java thread deadlock concept. It essentially involves 2 threads waiting forever for each other. This condition is often the result of flat ...

Synchronising Multithreaded Integration Tests
Testing threads is hard, very hard and this makes writing good integration tests for multithreaded systems under test… hard. This is because in JUnit there’s no built in ...

How to shoot yourself in foot with ThreadLocals
It will start nicely. Like most of the stories. You discover a new concept and are amazed by it’s powers. And then equipped with this new hammer suddenly everything starts to look ...

Java Thread Pool Example using Executors and ThreadPoolExecutor
A thread pool manages the pool of worker threads, it contains a queue that keeps tasks waiting to get executed. A thread pool manages the collection of Runnable threads and worker threads ...

How many threads do I need?
It depends on your application. But for those who wish to have some insight about how to squeeze out most from all those expensive cores you have purchased for your production site ...

Java Deadlock Example – How to analyze deadlock situation
Deadlock is a programming situation where two or more threads are blocked forever, this situation arises with at least two threads and two or more resources. Here I have written a simple ...

Waiting for the right moment – in integration testing
When you have to test multi-threaded programs, there is always the need to wait until the system arrives at a particular state, at which point the test can verify that the proper state ...

Can synchronization be optimised away?
Overview There is a common misconception that because the JIT is smart and synchronization can be eliminated for an object which is only local to a method that there is no performance ...

