< 2021SC@SDUSC > netty common codecs

2021SC@SDUSC preface Starting with this blog, we will introduce several encoders and decoders that have been implemented in netty. In this blog, we will introduce netty's LineBasedFrameDecoder class, which divides messages into different parts based on line breaks. 1, LineBasedFrameDecoder package io.netty.handler.codec; import io.netty ...

Posted by Gaoshan on Wed, 01 Dec 2021 03:35:51 -0800

Multithreaded learning four

Navigation 1,Multithreaded learning one 6. No lock of shared model In this chapter, we will implement concurrency control through non blocking optimistic locks 6.1 problem raising There are the following requirements to ensure the thread safety of the account.withdraw withdrawal method Test5.java public class Test5 { public static vo ...

Posted by BigMonkey on Tue, 30 Nov 2021 15:56:11 -0800

java mongodb orm implementation-ORM based on mongodb-driver

Introduction: MongoDB is a very promising database, and MongoDB officially locates itself as a generic database, which is somewhat like MySQL. Although its popularity is far from the level of MySQL, there is one possible inappropriate comparison. Like MySQL N years ago, MongoDB will become stronger and more popular over time. Due to the comple ...

Posted by shlomikalfa on Sun, 28 Nov 2021 16:00:56 -0800

Netty implements HTTP file server

1, DemandThe file server uses HTTP protocol to provide external services. When accessing the file server through the browser, the user first checks the URL. If it fails, an error 403 is returned; If the current directory is opened by link through verification, each directory or file is displayed in the form of hyperlink, which can be accessed r ...

Posted by mkohan on Sun, 28 Nov 2021 07:00:25 -0800

Netty advanced protocol design and analysis, HttpServerCodec, custom protocol Codec, source code analysis

summary When communicating between our client and server, we must abide by certain protocols. These protocols may have been designed in advance, such as Http protocol, or we can customize them. Last We explained some codecs provided by Netty, so that we can design some protocols ourselves. This article mainly explains the Http protocol in Ne ...

Posted by Steppio on Thu, 25 Nov 2021 11:21:22 -0800

Fundamentals of Netty

1, BIO (Blocking IO) 1. Characteristics In the synchronous blocking model, a thread can only process one request 2. Shortcomings The read operation in IO code is a blocking operation. If the connection does not read and write data, it will cause thread blocking and waste resources If there are many threads, there will be too many server t ...

Posted by tartou2 on Tue, 23 Nov 2021 04:01:41 -0800

Netty's responsibility chain model filter chain implementation source code analysis

2021SC@SDUSC Let's analyze the details of outbound data propagation. Let's start with the write method of ChannelOutboundHandlerAdapter: public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { ctx.write(msg, promise); } If you want to implement your own business processing logic, ...

Posted by alexszilagyi on Fri, 19 Nov 2021 11:45:54 -0800

Java IO learning note 8: multiplexing to Netty

Author: Grey Original address: Java IO learning note 8: multiplexing to Netty Multiplex multithreading The method is still a little troublesome. Netty helped us encapsulate it, greatly simplifying the coding complexity. Next, get familiar with the basic use of netty. Netty + implements a version of the code for communication between client a ...

Posted by Biocide on Wed, 10 Nov 2021 07:12:50 -0800

Deep analysis of core components in Netty based on a large number of images and instances

This article mainly analyzes the core components in Netty in detail. Initiator Bootstrap and ServerBootstrap, as the intersection of Netty's client and server, are the first step in writing Netty's network program. It allows us to assemble the core components of Netty like building blocks. In the process of building Netty Server, we need to pay ...

Posted by railanc4309 on Tue, 09 Nov 2021 18:30:01 -0800

< 2021SC@SDUSC > netty use -- implementation of simple chat room

2021SC@SDUSC preface In the initial use of the previous blog netty, we simply wrote the code between the client and the server to realize two-way communication. This time, we made some improvements on the basis of the last code and preliminarily realized the function of chat room. 1, Server 1,Server The Server class itself has not chang ...

Posted by bughunter2 on Fri, 05 Nov 2021 19:17:07 -0700