摘要: ArrayBlockingQueue实现,有容量限制的阻塞队列,实现原理如下class BoundedBuffer { final Lock lock = new ReentrantLock(); final Condition notFull = lock.newCondition(); final Condition notEmpty = lock.newCondition(); final Object[] items = new Object[100]; int putptr, takeptr, count; public void put(Object ... 阅读全文
posted @ 2014-01-28 14:05 大新博客 阅读(353) 评论(0) 推荐(0)