C++ uses thread pool to simulate asynchronous event processing mechanism

There are asynchronous event processing mechanisms in many C++ frameworks, which makes us often confused and difficult to understand when looking at the source code. The programming routines contained in it may be some mature technologies that we are not familiar with, such as WebRTC. It is similar to Qt’s signal and slot mechanism, thread […]

The principle of synchronized and the Callable interface

Table of Contents ?synchronized principle ?Lock upgrade ?Lock optimization ?Callable interface ?synchronized principle We know that synchronized locks can control multiple threads’ access to shared resources, and two threads will block and wait when accessing the same variable. The synchronized lock is not static, it will be upgraded according to the situation. ?Lock Upgrade JVM […]

CAS, Synchronized principle

What is CAS CAS application Atomic class spin lock ABA issues with CAS Synchronized principle Lock upgrade optimization Lock elimination optimization Lock coarsening optimization What is CAS What is CAS? Compare and swap: Compare and swap A CAS operation involves: We assume that the original data V in the memory, the old expected value A, […]

CompletableFutureBatch asynchronous task processing

When we encounter many businesses being processed at the same time in the project, if it is serial, it will definitely affect the performance. At this time, asynchronous execution is needed. When it comes to asynchronous execution, there must be many solutions. Option 1: For example, using spring’s asynchronous annotations, such as the following code, […]

Refactor Android asynchronous code using promises

Background Writing Android asynchronous tasks in business has always been a challenge. The previous callback and thread management methods were complex and cumbersome, making the code difficult to maintain and read. JavaScript actually faces the same problem in the front-end field, and Promise is one of its more mainstream solutions. Before trying to use Promise, […]

selenium waits for element loading, element manipulation, js execution, switching tabs, logging into cnblogs (chrome), and drawer semi-automatic likes

selenium waits for elements to load Code operations are very fast ? \dashrightarrow ? Some tags have not been loaded yet ? \dashrightarrow ? Can’t find it even if I look for it ? \dashrightarrow ? will report an error Set wait: show wait, hermit wait # Search for a certain tag. If it cannot […]

MySQL single table is too large, master-slave mode, synchronization mode optimization principle

Article directory Is the performance of MYSQL severely degraded when the data in a single table reaches 20 million? Preface InnoDB index data structure B + tree Sharding Sphere sub-database and table Sharding-JDBC Sharding-JDBC related concept description logical table Broadcast table binding table Sharding-Sharding strategy in JDBC Automatic sharding algorithm Modulo sharding algorithm Hash modulo […]

Handling the problem of out-of-synchronization of data from the database in Mysql8.0 version

Handling the problem of out-of-synchronization of slave data in Mysql8.0 version Situation 1: Error during synchronization During the synchronization process of the slave database, the master database deletes data. 1. The slave database does not synchronize the data of the master database Cause analysis: Caused by data synchronization error. Operation from library show slave status\G […]

SpringBoot and Axios asynchronous network request library implement file download (too damn pitfalls)

Preparation: Import the maven jar package <dependency> <groupId>org.webjars.npm</groupId> <artifactId>axios</artifactId> <version>1.5.1</version> </dependency> Step 1: Write the front-end page <!doctype html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0″> <meta http-equiv=”X-UA-Compatible” content=”ie=edge”> <title>Download Center</title> <style> .txt { color: green; } </style> </head> <body> <div id=”app”> <h1>Download Center</h1> <ol> <li><span class=”txt”>WeChat Mini Program Project</span> […]