Concurrent
文章平均质量分 71
TKD03072010
跆拳の尐輝龍
展开
-
Java内存模型——可见性
/** * 可见性问题 * @author Snway * */ public class Visibility { private static boolean stop; public static void main(String[] args) throws Exception { Thread t1 = new Thread(n原创 2013-01-15 16:33:08 · 3344 阅读 · 2 评论 -
Java内存模型——原子性
原子性:哪些指令必须是不可分割的。在Java内存模型中,这些规则需声明仅适用于-—实例变量和静态变量,也包括数组元素,但不包括方法中的局部变量-—的内存单元的简单读写操作。 /** * 非线程安全(原子性) * @author Snway * */ public class Atomicity { private int value; public int getN原创 2013-01-15 16:02:11 · 1303 阅读 · 0 评论