![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java 并发编程
iteye_20195
这个作者很懒,什么都没留下…
展开
-
java
class MutablePoint { private int x, y; public MutablePoint() { x = 0; y = 0; } public MutablePoint(MutablePoint copy) { this.x = copy.x; this.y = copy.y; } public int g...原创 2013-09-02 11:46:23 · 63 阅读 · 0 评论 -
java
/** * productor create the product,and does not care consumer */ class Productors extends Thread{ private final BlockingQueue queue; public Productors( BlockingQueue queue){this.queue =...原创 2013-09-05 13:56:22 · 60 阅读 · 0 评论 -
java
java同步工具类: CountDownLatch 等待某个事件,再执行。做到主线程同时释放工作线程,减少竞争 构造函数: new CountDownLatch(2) 方法:await 直到等待事件为0 方法:countDown() 减少等待事件 Semaphore用来控制访问某个资源的访问数量。例如数据库连接池,最多有10个。 构造函数: new Semaphore(10) ...原创 2013-09-11 17:40:49 · 64 阅读 · 0 评论