http://blog.csdn.net/u011860731/article/details/48733073
http://www.cnblogs.com/jym-sunshine/p/4694653.html
package com.yano.reflect;
public class ThreadLocalExample {
public static class MyRunnable implements Runnable{
private ThreadLocal threadLocal = new ThreadLocal();
@Override
public void run() {
threadLocal.set((Math.random()*100D));
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(threadLocal.get());
}
}
public static void main(String[] args){
MyRunnable myRunnable = new MyRunnable();
Thread thread1 = new Thread(myRunnable);
Thread thread2 = new Thread(myRunnable);
thread1.start();
thread2.start();
}
}