Java Concurrency (java-concurrency)

Why Do We Need Completable Future?

Why do we need CompletableFuture? What is its strength compared to synchronous code and classic future in Java? How to remember its APIs?

Write An Actor In Akka

How to write a new actor in Akka in Java? This post explains actor creation, message reception, and testing.

3 Ways to Handle Exception In Completable Future

How to handle exception in CompletableFuture? This article explains the difference between handle(), whenComplete(), and exceptionally().

How CompletableFuture is tested in OpenJDK?

How CompletableFuture is tested in OpenJDK 14? What can we learn from it?

Asynchronous Processing in JAX-RS 2.x

Quick introduction of asynchrnous processing in JAX-RS 2.x on both server-side and client-side.

Akka: Testing Actor with TestActorRef

Unit testing Akka actor with "TestActorRef", which gives you access to underlying actor instance and runs the logic synchronously in a single-threaded environment.

ExecutorService.invokeAll()

Using 100% CPU effortlessly in Java: submit all your tasks to thread pool and wait for completion.

Method Execution In Multithreading

Today I met some multithreading problems. Many Java syntax become very confusing in a multithreading environment. So I created a mini Java program, and wrote this study note to clarify the unclear methods. This blog post will go through the following steps:

  1. Source code and execution
  2. Understand Thread#join()
  3. Understand logic sharing
  4. Understand variable sharing

Introduction to Threads

Today, I want to share with you an introduction to multithreading in Java. In order to make the blog post more fun, I'll use the roles of "Game of Thrones" in my examples: white walkers and the Night King. After reading the blog post, you'll understand: How to create and run a thread, use wait(), notify(), notifyAll() and join().