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.
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.
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.
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.
Netty is one NIO framework in Java. What Netty provides is the event loop. If you don’t understand what event loop is, please read https://medium.com/@Ryan_Zheng/event-loop-distilled-3a47b9923c66.
NIO In General
In network programming, the server socket needs to bind to a port and network interface. Then the server socket will call accept function. This accept function will return a new Socket when a new client connects to the server. Now the server and client can communicate over this connected socket. The server socket could return to accept function again to wait for other connections.
server = new ServerSocket(port, interface)newSocket = server.accept()
The Channel here we talked about is different from the Channel in Java NIO. NIO Channel is a wrapper around file descriptors. The Channel here is about message sending.
Spring Channel is the fundamental building block of Spring Messaging. Channel is a way to send messages. Here send means literally “send”. That’s why the very top interface of Spring Channel has only send method.
Since MessageChannel is a way to send messages, so who is invoking the send method?
The answer is some other consumer is using the channel to send messages.
But we care about how to connect channels…
I am a software developer who is keen to know how things work