How to realize inter thread communication in Java

The world kisses me with pain and asks me to return it with a song -- Tagore's collection of birds Although usually each sub thread only needs to complete its own task, sometimes we want multiple threads to work together to complete a task, which involves inter thread communication. With regard to inter thread communication, the methods and ...

Posted by firecat318 on Sat, 20 Nov 2021 08:09:09 -0800

Use of Android retro fit

Use of Android retro fit 1, Overview 1. What is retrofit Retrofit is a popular network request framework. It can be understood as an enhanced version of okhttp. Okhttp is encapsulated at the bottom. To be exact, retrofit is the encapsulation of a RESTful http network request framework. Because the network request is essentially completed ...

Posted by kporter.porter on Sat, 20 Nov 2021 07:48:38 -0800

Java thread pool principle, China CITIC Bank Java written test questions

Status of thread pool (5 kinds): The AtomicInteger variable ctl is very powerful: the low 29 bits represent the number of threads in the thread pool, and the high 3 bits represent the running state of the thread pool: RUNNING: -1 << COUNT_ Bits, that is, the upper 3 bits are 111. The thread pool in this state will receive new tasks and ...

Posted by dolphinsnot on Sat, 20 Nov 2021 07:10:40 -0800

Mybatis LUS code generator and some optimizations

To use the mybatis plus code generator, you must first add dependencies (also known as import packages), and import packages according to the official website recommendations and project requirements Official website link: https://mp.baomidou.com/guide/ 1. Add code generator dependency <dependency> <groupId>com.baomidou&lt ...

Posted by fean0r on Sat, 20 Nov 2021 05:35:54 -0800

Construction of centos7 Nacos service registry

Construction of centos7 Nacos service registry Since the spring cloud registry Eureka has long stopped maintenance, we use Nacos official: https://nacos.io/zh-cn/docs/what-is-nacos.html Welcome to the world of Nacos! Nacos is dedicated to helping you discover, configure, and manage microservices. Nacos provides a set of easy-to-use feature ...

Posted by Royalmike on Sat, 20 Nov 2021 05:25:26 -0800

Java 8 array parallel sorting example | array partial sorting

On this page, we will provide an example of java 8 Arrays parallel sorting. Java 8 introduces a new method, parallelSort(), in the array class. 1. Java 8 Arrays.parallelSort() uses the sort merge algorithm to decompose the array into sub arrays, and then sort and merge them themselves. 2. The array is decomposed into subarrays, and the subar ...

Posted by Royalmike on Sat, 20 Nov 2021 05:07:08 -0800

On the relationship among BeanDefinition, BeanDefinitionMap and rootbeandefinition

Through this article, you will gain: The relationship among rootbeandefinition, BeanDefinition and BeanDefinitionMap is its basic meaning Implementation subclass of BeanDefinition interface Meaning of beanClass member variable in BeanDefinition subclass Process for obtaining rootbeandefinition according to beanName 1, BeanDefinit ...

Posted by bombayduck on Sat, 20 Nov 2021 05:03:48 -0800

Spring Boot + MyBatis + MySQL to realize read-write separation

Author: Waste elder martial brother Source: https://www.cnblogs.com/cjsblog/p/9712457.html 1. Introduction The task of read-write separation is to select which database to execute an SQL. As for who will select the database, there are no more than two. Either the middleware will help us or the program will do it by itself. Therefore, general ...

Posted by hdpt00 on Sat, 20 Nov 2021 04:50:14 -0800

Atomic operation class summary, why is it more and more difficult to interview middle and senior posts in Java

The implementation principle of AtomicLong is consistent with AtomicInteger, except that one is for long variables and the other is for int variables. How does the AtomicBoolean class update the boolean variable? The core method is compareandset method, and its source code is as follows: public final boolean compareAndSet(boolean expect, bool ...

Posted by Xianoth on Sat, 20 Nov 2021 03:01:09 -0800

Java foundation -- different regional representations of thread safety (synchronization lock and monitor), thread blocking (sleep and wait), wake-up mode, lock (mutual repulsion lock), and fair lock

Fundamentals of Java (19)—— 1, Thread safety (sync lock and monitor) 1. Primer -- thread unsafe For example, introduce a security lock: 10 stores, selling 1000 computers at the same time. The code is 10 threads competing for a resource (the code is as follows): This will cause a serious problem, that is, multiple threads will c ...

Posted by spetsacdc on Sat, 20 Nov 2021 02:20:40 -0800