笔记备份:2025-08-21 22:32:27

This commit is contained in:
2025-08-21 22:32:27 +08:00
parent 0c5d79c60e
commit 1792513c9d
3 changed files with 21 additions and 10 deletions

View File

@@ -538,11 +538,11 @@
}
},
"2025-08-21": {
"totalDelta": 14256,
"totalDelta": 14541,
"files": {
"A1-Work/语言/Java/基础学习.md": {
"initial": 10752,
"current": 12301
"current": 12586
},
"A6-Excalidraw/线程状态.md": {
"initial": 3237,

View File

@@ -463,20 +463,20 @@
"isCountable": true,
"targetNodeType": "file",
"noteCount": 1,
"wordCount": 3941,
"wordCount": 3972,
"wordCountTowardGoal": 0,
"wordGoal": null,
"pageCount": 13.136666666666667,
"characterCount": 14107,
"nonWhitespaceCharacterCount": 10873,
"newlineCount": 579,
"readingTimeInMinutes": 9.06143396226415,
"pageCount": 13.24,
"characterCount": 14149,
"nonWhitespaceCharacterCount": 10909,
"newlineCount": 583,
"readingTimeInMinutes": 9.12166037735849,
"linkCount": 0,
"embedCount": 2,
"aliases": null,
"createdDate": 1753961160249,
"modifiedDate": 1755785864301,
"sizeInBytes": 21259,
"modifiedDate": 1755785919659,
"sizeInBytes": 21369,
"sessionStart": {
"noteCount": 1,
"pageCount": 2.1566666666666667,

View File

@@ -561,7 +561,18 @@ classDiagram
唯一的用途就是为其他线程提供服务。
### 同步
锁对象 `ReentrantLock``synchronized`
```Java
// 锁对象
private Lock bankLock = new ReentrantLock();
// 条件对象,可以用来调用 await条件不满足先等待、signalAll唤醒所有等待的线程、signal随机唤醒一个等待的线程
private Condition sufficientFunds = bankLock.newCondition();
// 获取锁
bankLock.lock();
// 释放锁
bankLock.unlock();
```
## JDK 特性