ArrayBlockingQueue ArrayBlockingQueue是Java多线程常用的线程安全的一个集合,基于数组实现,继承自AbstractQueue,实现了BlockingQueue和Serializable接口. //先看看器内部的成员变量: private static final long serialVersionUID = -817911632652898426L;//实现了序列化接口 /** 基于数组的实现,内部持有一个Object数组 */ final Object[…
/** * 使用BlockingQueue实现主子线程互相打印 * @author duwenlei * */ public class BlockingQueueTest { public static void main(String[] args) { final Business business = new Business(); new Thread(new Runnable() { @Override public void run() { while(true){ busines…
package com.thread.test.thread; import java.util.Random; import java.util.concurrent.*; /** * Created by windwant on 2016/5/26. */ public class MyBlockingQueue { public static void main(String[] args) throws InterruptedException { testArrayBlockingQu…