特牛生活网

生产者 - 消费者模型_马各阿牛的博客-CSDN博客

网友收藏
文章浏览阅读142次。1. 使用syncronize实现 static Object[] items = new Object[100]; static int takePoint = 0, putPoint = 0; static AtomicInteger cnt = new AtomicInteger(0); public synchronized static void produce(Object o) throws InterruptedException { w