当前位置:网站首页>Three locking methods of the bottom layer of synchronized: (3.21-3.27)
Three locking methods of the bottom layer of synchronized: (3.21-3.27)
2022-04-22 05:16:00 【Look, water is water】
Decorate common methods : It modifies the instance object of the class , Also called object lock , There are two scenarios :1. Two threads execute the same lock object in two synchronization methods , Will form mutually exclusive scenes ;( Because the objects of the lock are the same )
2. Two objects execute the same synchronization method in two threads , Not mutually exclusive ;( The objects of the lock are two )
Modified static method : Decorated class objects , Also called class lock ; Three usage scenarios :1. A class object executes different synchronization methods in two different threads , They are mutually exclusive ; Because it is the same class object lock
2. A class object executes a normal locking method and a static locking method , Will also be mutually exclusive , Like the above, it is a class object lock
3. Static method locks and ordinary method locks executed by an object , No mutual exclusion , Because the mechanisms of the two objects are different ;
Decorated code block :1. Decorate common methods , Regular in parentheses (this) In itself ;2. Decorated class object ( This kind .class);3. Modify arbitrarily defined Object Objects of type are in parentheses ;
版权声明
本文为[Look, water is water]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210626121960.html
边栏推荐
- Log4 日志框架
- The SQL backup bak in the batch compression folder is rar, and then delete the RAR 3 days ago
- QBoxSet、QBoxPlotSeries
- mysql rank() over,dense_ rank() over,row_ The difference between number () and over
- Socket communication between server and client
- Junit Introduction et Introduction
- Reading: analyzing third party service dependencies in modern web services
- [I. XXX pest detection project] 2. Trying to improve the network structure: resnet50, Se, CBAM, feature fusion
- After the MySQL database runs the code, the question mark is displayed in Chinese?
- Go language crawler Foundation
猜你喜欢

Mongodb experiment -- data backup and recovery and database optimization

Summary of browser cross domain problems

Chapter IX user and authority

Uninstallation, installation and setting of MySQL

Final Cut Pro mosaics in multiple places of the video at the same time

How to restrict Oracle sub query

What kind of programming language is this to insert into the database

Error: ER_ NOT_ SUPPORTED_ AUTH_ MODE: Client does not support authentication protocol requested by serv
What are the challenges of Internet of things testing, and how do software testing institutions ensure quality

Leetcode 1423. Maximum points you can obtain from cards
随机推荐
[Reading Notes - > statistics] 07-03 introduction to the concept of discrete probability distribution Poisson distribution
MySQL encoding problem
Common test methods
Reading: analyzing third party service dependencies in modern web services
Feign calls the service, and the called service Seata transaction is not opened or XID is empty
TDD开发模式与DDD开发模式
Chapter I overview of database
A collection of common methods of data exploratory analysis (EDA)
Final Cut Pro mosaics in multiple places of the video at the same time
Regular expression of shell script
Mysql database for the 11th time
2021-10-17
Measuring the global recursive DNS infrastructure: a view from the edge
Chapter IX user and authority
Three paging query methods of SQL Server
Generic types in classes and generic types
Junit断言
The eleventh job of MySQL database - Application of view
What is an iterator
Realization of online Preview PDF file function