生产者消费者模型使用notify的死锁分析
public class Model {
private static final int MAX = 6;
private LinkedList<Integer> list = new LinkedList();
public Integer getDate() throws InterruptedException {
Random random = new Random();
int nextInt = random.nextInt(10);
Thread.sleep(nextInt);
return nextInt;
}
//producer
public synchronized void producer() throws InterruptedException {
if(list.size()==MAX){
System.out.println("producer "+Thread.currentThread().getName()+" wait...");
wait();
System.out