摘要:
1. 1 public class ConnThreadLocal { 2 3 //线程变量副本,每个线程都有一个,所以多线程的时候,就不会出现覆盖.而是每个线程一个 4 public static ThreadLocal<String> th = new ThreadLocal<String>() 阅读全文
摘要:
1. final List<String> synchronizedList = Collections.synchronizedList(tickets);//list变成线程安全的 1 public class Tickets { 2 public static void main(String 阅读全文
摘要:
1. 1 public class ListAdd2 { 2 private volatile static List list = new ArrayList(); 3 4 public void add(){ 5 list.add("hello"); 6 } 7 8 public int siz 阅读全文