随笔分类 - 4.多线程高并发
摘要:1.无volatile /**volatile 有序性验证 * @author xueci * */ public class TestSequence { static int a,b; static int x,y; public static void main(String[] args)
阅读全文
摘要:/**无法保证原子性 * @author 雪辞 * */public class TestAtomicity {private volatile static int count=0;public static void main(String[] args) { //启动十个线程 for (int
阅读全文
摘要:代码1:不使用volatile /**volatile 可见性* @author 雪辞**/public class TestVisibility { private boolean initFlag=false;public void refresh(){ this.initFlag=true;
阅读全文

浙公网安备 33010602011771号