Multithreaded server programming [2] - Essentials of thread synchronization

Four principles of thread synchronizationMinimum sharing of objects, reducing the need for synchronizationUse advanced concurrency components, such as TaskQueue, producer consumer queue, CountDownLatch, etcWhen you have to use the underlying synchronization primitive, only use non recursive mutexes and conditional variables. Use read-write lock ...

Posted by metuin on Tue, 23 Nov 2021 06:26:00 +0100

Algorithm from getting started to giving up -- the fourth issue

Recently, we have been reading the classic series carefully. The main reason is that we have brushed a lot of algorithm problems. In order to keep up with the update rhythm, we have supplemented the algorithm from getting started to giving up the series. Most of the previous string splits are dynamic rules. Today we do some DFS, which is not s ...

Posted by cal_biker on Tue, 23 Nov 2021 04:55:25 +0100

An easy to understand and read Lamda expression, with detailed analysis of the source code

Lamda expression is very convenient. It is generally used in stream programming in projects. List<Student> studentList = gen(); Map<String, Student> map = studentList .stream() .collect(Collectors.toMap(Student::getId, a -> a, (a, b) -> a)); There are three steps to understand a Lamda expression: Confirm the type o ...

Posted by Solarpitch on Tue, 23 Nov 2021 04:41:49 +0100

Annotations and custom annotations

annotation Annotation is very powerful. It can enhance our java code, and use reflection technology to expand and realize many functions. They are widely used at the bottom of the three frameworks. Traditionally, we use XML text file declaration (as shown in the figure below, but XML is cumbersome and difficult to check), but now the most ...

Posted by suave4u on Tue, 23 Nov 2021 04:18:53 +0100

Set interface and the underlying application of its implementation class

1, Set The set interface is a sub interface of the Collection. The set interface does not provide additional methods The Set set cannot contain the same elements. If you try to add two identical elements to the same Set set, the add operation fails. Set determines whether two objects are the same, not by using the = = operator, but by using ...

Posted by Kenny Pollock on Mon, 22 Nov 2021 13:29:21 +0100

Learning the structure of java

catalogue 1. Branch structure 1.1 general 1.2 structural form 2.switch structure 3. Circulation structure 3.1 for loop overview 3.2 for loop structure 3.3 for loop code 3.4 nested for loop code 4.while loop and do while loop 4.1 while loop (judge first and then execute) 4.2 do while loop (execute first and then jud ...

Posted by nominator on Mon, 22 Nov 2021 06:58:01 +0100

[JAVA data structure] realized by JAVA language - the basic function of headless two-way linked list (with super detailed code comments)

[preface] in the previous article, we have learned about the basic functions of sequential list and single linked list. Next, let's learn how to realize the basic functions of two-way linked list. First, let's take a look at the structure of the two-way linked list: Headless bidirectional linked list Concept and structure of bidirectio ...

Posted by Cronje on Sun, 21 Nov 2021 22:53:23 +0100

RabbitMQ introduction and springboot integration

​ 1. What is message queue Message queue is mainly used to manage asynchronous messages (after registration, SMS sending is not necessary, and queue can be used). Realize the two-way decoupling between systems, and also play the role of message buffer and message distribution. When the producer generates a large amount of data, but the consum ...

Posted by natman3 on Sun, 21 Nov 2021 21:35:21 +0100

Java Concurrency Tool Learning - A Simple Chat with ConcurrentHashMap

Preface The blog started a quick peek at Java Concurrency Containers after a simple peek at CAS and final keywords in the previous post. HashMap, ArrayList, and so on, are non-thread-safe. In Java, if you want HashMap and Array List to be thread safe directly, you can do so by doing the following Collections.synchronizedList(new ArrayList ...

Posted by Rongisnom on Sun, 21 Nov 2021 18:52:36 +0100

Kotlin - coprocessor and operator overloading, Java programmer autumn recruit three-sided ant gold suit

Kotlin files and classes do not have a one-to-one relationship Symbiont inherit Modifier Null pointer problem text Key and difficult points Synergetic process I've thought about it for a long time. There are a lot of contents on the official website, including basic knowledge, concepts, basic usage, stream operation, channel, excepti ...

Posted by aircooled57 on Sun, 21 Nov 2021 09:43:14 +0100