public class A1 {
public static ThreadLocal tl = new ThreadLocal();
static Integer a=1;
public static void main(String[] args) {
for (int i = 0; i < 3; i++) {
new Thread() {
public void run() {
try {
synchronized (a) {
Thread.sleep(10);
tl.set(Thread.currentThread().getName()+"-----"+a++);
System.out.println(Thread.currentThread().getName()+"-----"+tl.get());
// b.getTl().remove();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
}
}
}