先写一段这个阻塞队列的例子吧
public static void main(String[] args) throws Exception{
BlockingQueue<String> a=new ArrayBlockingQueue(1000);
Thread t1=new Thread(new Runnable() {
@Override
public void run() {
try {
for(;;) {
Thread.sleep(500l);
String a = a1.take();
System.out.println("线程t1消费"+a);
}
}catch (Exception e){
System.out.println("线程t1");
e.printStackTrace();
}
}
});
t1.start();
Thread t2=new Thread(new Runnable() {
<