
Java Threads Explained From Thread to ExecutorService
Learn how to start threads, wait for them, share results with futures and move to executors and virtual threads, with the rules that keep code correct.
Threads, executors, locks, CompletableFuture and virtual threads, and the races hiding between them.

Learn how to start threads, wait for them, share results with futures and move to executors and virtual threads, with the rules that keep code correct.

Use Vaadin Push to update the UI from background threads: enable Push on the app shell, wrap changes in ui.access, and handle detach and long running tasks.

Reproduce a lost update in JPA with two transactions, then fix it with a version column, an atomic update query or a pessimistic lock, and test the conflict.

Use optimistic locking with a JPA version column: map @Version, handle OptimisticLockException, retry safely and expose the version through a REST API.

What the Java Memory Model guarantees about visibility and ordering, how happens-before edges are created and why unsynchronized code can loop forever.

Test asynchronous code with Awaitility instead of Thread.sleep: await until a condition holds, tune timeouts and poll intervals, and avoid flaky waits.

Recognize a Java deadlock in a thread dump, find the two locks and threads involved, and remove the cycle with lock ordering, timeouts or smaller locks.

Fix RejectedExecutionException by telling a full queue from a shut down executor and choosing a pool size, queue bound and rejection policy on purpose.

Implement distributed locks in Java: why a JVM lock is not enough, Redis and database options, lease expiry, fencing tokens and when to avoid locks entirely.

Decide between volatile, synchronized and atomic classes for shared state, with the counter example that shows why volatile alone is not enough.

Use Hibernate Reactive in Quarkus with Mutiny: the Uni and Multi return types, reactive Panache, transactions and when blocking ORM is the better choice.

The four SQL isolation levels and the anomalies they allow, including phantom reads, how PostgreSQL and MySQL differ and how to set a level in Java.
We send one email when a new post is published. No spam.