`

Blocking Queue Usage

 
阅读更多

3 implementations: LinkedBlockingQueue, ArrayBlockingQueue, SynchronousQueue,

 

 

About threading communication, use wait()/notify()/notifyAll() is really quite low level. And it's error-prone, and it's difficult to debug.

 

In java5, we strongly suggest using BlockingQueue to take the place of wait()/notify()/notifyAll() communication mechanism.

 

In the program of Toast O Matic, you can easily see how 4 threads cooperates together using 3 blockingQueue.

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics