forked from CharonChui/AndroidNote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc746ca
commit eee5d06
Showing
1 changed file
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,8 +96,9 @@ JDK1.5 中提供了多线程升级解决方案。 将同步Synchronized替换成 | |
将Object中的wait,notify notifyAll,替换了Condition对象。 该对象可以Lock锁 进行获取。 该示例中,实现了本方只唤醒对方操作。 | ||
Lock:替代了Synchronized lock unlock newCondition() | ||
Condition:替代了Object wait notify notifyAll await(); signal(); signalAll(); | ||
```java | ||
import java.util.concurrent.locks.*; | ||
|
||
```java | ||
import java.util.concurrent.locks.*; | ||
|
||
public class ProducerConsumerDemo2 { | ||
public static void main(String[] args) { | ||
|
@@ -195,8 +196,8 @@ class Consumer implements Runnable { | |
} | ||
} | ||
} | ||
``` | ||
|
||
``` | ||
--- | ||
|
||
- 邮箱 :[email protected] | ||
|