The key of reactive Programming is to analyze data dependency and event dependencies instead of the underlying running environment. The running environment can be a virtual thread, a coroutine, or a native thread that can be switched. However, the data dependency will never change. Data dependency is bound to the business itself.

In this article, we will use simple examples to incrementally demonstrate what the above sentence means, and how we can transform the existing codes into reactive codes.

Example: John, please open the door when the doorbell rings.

The above sentence can be broken down into two objects, and…


Previously I have written one article about Reactive Streaming. But that article is just the design of Reactive Streaming as a result. It does not explain why Reactive Streaming comes into existence, how server applications evolve from imperative programming to reactive streaming.

In this article, I will try to explain why Reactive Streaming is designed, and what problem it wants to solve.

We will look at a simplified book server to explain different threading models, the problems they introduce, and the proposals of solutions. …


Containers on Linux utilize the namespaces provided by the Linux kernel. On Linux, the containers are running as normal processes which share the same kernel as other processes. On Windows or Mac, one virtual machine is provided first. All the containers are running inside the virtual machine.

Resource Namespace

In computer science, everything can be represented by an object, including network devices, processes, threads, PID numbers, routing tables, file systems, etc.

If we define a namespace object, then put the network device objects as a member of this namespace object, then we are able to restrict the scope of network devices to…


The goal of this article is to manually add one public attribute into the class file. When the class loader finishes loading the modified class file, we are able to see our manually added field.

After the Java compiler compiles our code, a class file is generated. This class file contains the byte code instructions defined by Java specification. However, it’s still one physical file. In the end, this file has to be loaded into memory, parsed, then the Class object is constructed. Consider this as parsing an XML file, we have to first define what nodes are allowed in…


First We will look at how Gradle Plugin works internally. Then we will build a custom plugin to extract our common configurations from build.gradle.kts to our own custom plugin.

The first thing to notice is that Gradle itself is one Java application. The Gradle project will run on all of our build.gradle.kts files and carry out build actions. The output of the Gradle build is our own application.

Every Java program needs dependent libraries on the classpath. The Gradle build is no different. It needs all the necessary libraries to finish the build process. …


The key components in Reactive Streaming or Reactive System are the resource, publisher, subscriber.

One real-life example is when we register membership of medium, we immediately receive one email notification saying what we have registered.


Let’s first understand the concept using newspaper subscription. I subscribe to a monthly newspaper. I signed a contract with the company and received a newspaper every month. The contract records what I have subscribed to. The company which produces the newspapers will look at the contract and send the product to me each month. I am also able to unsubscribe through their website. In this example, we have three objects, the company producing the products, the receiver(me), and the contract. The important and subtle object is the contract. It’s the contract that connects me and the company together.

Another example…


The core design idea behind GraphQL is to treat our application as a database. A database is able to return the values restricted by the fields specified in the select statement. GraphQL gives the frontend the options of returning only the fields it specifies.

In the following, we compare GraphQL architecture with the Rest architecture.

Rest Architecture

Rest Architecture

In the Rest architecture, there are multiple controllers, facades, services and DAOs. Every controller is responsible for different request mapping. In controllers, we deal with DTO. Facade is usually used for data conversion between DTO and DAO. …


Before talking about Work Stealing, we need to talk about task management. We could use Tomcat as one example. Tomcat will use multiple threads to handle concurrent connections. The number of threads can go very high when there are many concurrent connections at the same time.

However, a computer has a fixed number of cores. The number of threads that could be run at the same time is equal to the number of cores. All other threads have to be in waiting/ready states. The ready state threads will be scheduled to take over the CPU when the current running thread…


This article is based on some basic understanding of Rabbitmq(Queue,Consumer,Producer etc). When communicating with Rabbitmq server, a connection is required. The design of the connection in any framework is more or less the same. The Connection has to wrap a TCP/UDP Socket connection in one way or another. In amqp-client, SocketFrameHandler is used to wrap a TCP Socket.

SocketFrameHandler provides the functionality of reading from and writing to the socket.

Ryan Zheng

I am a software developer who is keen to know how things work

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store