"Actual Java High Concurrency Programming" source code sorting and reading notes

daily verbose

Don't be frightened by the title, although the book is "Practical Java High Concurrency Programming", this article is just to write about my reading experience, and I sorted out the code in the book by the way. In fact, I didn't want to type the code, but I went After searching around on the Internet, I found that there is no ready-made one. I can only type it myself. Now that I have sorted out some of the code, I simply upload it to GitHub, so that everyone can take a look and save other people's time. GitHub address Here , if you can't access it, you can also go to the code cloud warehouse to see it. The address is here . Give the project a star.

Book Introduction

book cover
When I was choosing a book on JD.com, I was attracted by the cover of this book. I liked this book inexplicably. I just wanted to add some knowledge in this area during that time. After reading the book introduction, I placed the order and bought it. .

I started reading on April 10, 2017, and finished it on the 30th. In the middle of the 20 days, I basically took a short period of time at noon to read. Although I didn’t read much every day, it was different when added together. After I finished it, it reminded me of a sentence from my high school physics teacher:

"Small steps, no steps, equals a big step forward"

Although the amount is small when viewed separately, the concept is different when accumulated gradually.

The whole book feels pretty good after reading it. The number of cases is very large and the quality is very high. I have gained a lot from hands-on practice, and it has also met the expectations before buying the book. The theoretical knowledge is not particularly obscure, and the code is also very good. It is clear that there are far more positive reviews of this book than negative reviews, and the knowledge points are rich and I have learned the knowledge points that I want to learn.

study notes

The book is an introduction to knowledge points, as well as some code cases. The author explains it in great detail, so I won't talk about it in this article, it's all conceptual knowledge.
The book is a good book, and the case is also a good case. Personally, this book also has shortcomings. Of course, this is just a personal opinion. The biggest flaw in this book should be the illustrations:





the illustrations in the book are basically in this style. , and some illustrations are a little unclear due to printing reasons, so the biggest slot is this.

  • In the process of reading the book for the first time, I did not follow the author's ideas to type code cases, but just made some comments in the book with a pen, because I thought there should be relevant source code resources on the Internet, but I found a lot of them. I haven't found it for a long time, so I wrote it myself. I think there are people who are as lazy as me to type the code, so I plan to publish it on the Internet.
  • There are two threads in the code. After downloading the source code, you can simulate the operation of multiple threads in the editor.
  • I have deepened my understanding of threads and high concurrency. I read the whole book again in the process of writing the article and sorting out the source code. I feel that I have learned a lot, and I am even more impressed. I may forget it after a while, who knows.

When I read it for the first time, I was actually mentally prepared, and I said to myself that if the theoretical sense in the book is too strong, read it slowly, turn a few pages a day, and if there are many code cases, just type more code. After reading it, I found that some chapters are really more theoretical, but I can read it with patience. I take some time every day to turn a few pages, and I slowly finish reading it. As for typing the code, I didn’t do it. Because I think there should be related resources on the Internet, I don't know, there is none.

A few knowledge points that are more impressive are instruction rearrangement, comparison and exchange of CAS, ThreadLocal, and read-write lock optimization. I will mention them here. I will not write them in detail. Friends who want to know more search by themselves. A detailed introduction will make you gain a lot.

Reading experience

I don't know if you have this feeling. I "love it and hate it" about the knowledge points of multithreading and locking. It feels very close and far away. Or take the first step and don't want to move on, and feel that these knowledge points are particularly difficult.

The knowledge of threading is relatively vague. When I first learned Java, I didn't pay much attention to it. I felt it was a bit obscure and difficult to understand. Later, when I worked, I didn't come into contact with similar coding requirements, which caused a strange circle of thinking. I am inexplicably curious, and I cannot fully convince myself to study it seriously and have a thorough understanding of it. I really don’t use it much in my daily work, and I have tried to learn it, but I feel that the process is rather boring, but it is indeed true. I know the importance of this knowledge point, and I also know that some frameworks or tools must use these knowledge points at the bottom, but I haven't written the relevant code myself.

In fact, I read this book because of curiosity. I don’t want to always have a little fear of a knowledge point. I feel that it is better for me to master it. If it was a year ago, I might not be able to read this book. Because at that time, I hadn't developed the habit of reading books. At the beginning, I would go to Baidu to search for knowledge, read blogs, etc., and seldom took the initiative to learn, let alone read books, and slowly I found this kind of fragmented The traditional knowledge learning method has not completely solved the problem of low skill mastery, and the knowledge points are too fragmented to form their own knowledge system coherently, and the skill stack is not comprehensive, so since last year, I began to actively buy technical books and skills related In terms of books, I gradually changed from not being able to read at all, to forcing myself to read a little, and then to reading a few pages a day, and finally I was able to keep reading one book, followed by the second book, the third book...

Because I wanted to read books, and I gradually developed the habit of reading books, so it was very easy to finish reading this book. Later, I read it again because I sorted out the source code of the book, even if it deepened the impression.

Epilogue

This article is mainly to talk about my own experience. In fact, they are all complaints. The key is the source code of the book. Because there is really no relevant documentation for this book on the Internet, so I sorted it out myself. Friends of this book, if you don’t want to type the code in the book a little, you can go directly to my github repository to download the code.

In fact, I just don't want to type the code, hahahaha, after searching the Internet, I found that there is no ready-made one, so I can only type it myself. Now that I have sorted out some of the code, I simply upload it to GitHub for everyone to take a look at. Look, save other people's time, the GitHub address is here , if you can't access it, you can also go to the code cloud repository, the address is here , give the project a star.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325782075&siteId=291194637