How is thread reuse in a Java thread pool implemented?

A few days ago, a group member of the technical group asked a question about the thread pool, as shown in the figure: So let's talk about this. In a thread pool, threads read tasks from workQueue to execute. The smallest unit of execution is Worker, which implements the Runnable interface and overrides the run method.The method is to let eac ...

Posted by denniston on Tue, 16 Jun 2020 18:25:54 +0200

SpringBoot startup process and project creation

catalog Project creation Interpretation of spring boot project architecture SpringBoot startup process Execution entry SpringApplication instantiation Spring application running appendix Project creation Here we use IDE to create projects. When the scaffold is completed, I'm going to get anoth ...

Posted by Dilbert137 on Tue, 16 Jun 2020 09:28:26 +0200

Beginner level chapter nine violent recursion

The introduction course of algorithm of Zuo Chengyun, teacher of niuke.com Violent recursion principle Hanoi Tower problem problem Print the process of the n-layer Hanoi tower moving from the left to the far right thought There are six processes, left to right, left to middle, middle to lef ...

Posted by simon71 on Tue, 16 Jun 2020 07:03:14 +0200

Principle analysis of AbstractQueuedSynchronizer

Source of this article Principle analysis of AbstractQueuedSynchronizerReprint please specify Abstract queuedsynchronizer, AQS for short, is a common dependency framework for most of Java, such as Lock, Semaphore, CountDownLatch, etc., which implements blocking locks that rely on FIFO waiting queues. Reading its code principle is helpful for us ...

Posted by bobthebuilder on Tue, 16 Jun 2020 07:01:11 +0200

Spring Boot encrypts and decrypts configuration files at startup

Spring Boot Application events and listeners Find application.yml Read operation of. from spring.factories View in # Application Listeners org.springframework.context.ApplicationListener=\ org.springframework.boot.context.config.ConfigFileApplicationListener,\ ConfigFileApplicationListener this object pair application.yml Read operation Li ...

Posted by literom on Tue, 16 Jun 2020 05:41:14 +0200

On Jetpack -- ROOM database

On Jetpack(1) - ViewModelOn Jetpack(2) - LifecyclesOn Jetpack(3) - LiveDataDemo project Although Android carries SQLite, its operation is troublesome, and if it is a large-scale project, it will become confusing and difficult to maintain, unless you design a very good architecture and package. Of cour ...

Posted by Runnion on Tue, 16 Jun 2020 05:22:09 +0200

Difference between locking and fence and applicable scenarios

Opening I believe that little partners know more or less about these two words. They are common thread communication tools in concurrent programming. The two are very similar, but they are different, which leads to a lot of confusion among many small partners, including me: what is the difference between them, and what scenarios are they applic ...

Posted by rsanc on Tue, 16 Jun 2020 04:34:12 +0200

Ten suggestions for Java exception handling

Preface Ten suggestions for Java exception handling, I hope to help you ~ This article has been uploaded to github: https://github.com/whx123/Jav... Public number: A little boy collecting snails First, try not to use e.printStackTrace(), but to use log printing. Counterexamples: try{ // do what you want }catch(Exception e){ e.printStackTr ...

Posted by sheilam on Mon, 15 Jun 2020 18:07:36 +0200

LinkedList is 1000 times slower than ArrayList? (dynamic graph + performance evaluation)

Array and linked list are two kinds of data structures commonly used in the program, and they are also one of the interview questions often tested in the interview. However, for many people, they just vaguely remember the difference between them. Maybe they still don't remember it right. And every time they come for an interview, they have to r ...

Posted by nomis on Mon, 15 Jun 2020 07:07:42 +0200

Research on Davids principle: thread synchronizer in Java Concurrent package (CountDownLatch, CyclicBarrier and Semaphore)

Article catalog Thread synchronizer in Java Concurrent package (CountDownLatch, CyclicBarrier and Semaphore) CountDownLatch Core method 1: countDown Core method 2: await Core method 3: getCount CyclicBarrier Core method 1: await Core method 2: reset Semaphore Core method 1: construction Core me ...

Posted by Richard Bowser on Mon, 15 Jun 2020 06:48:35 +0200