1. JMM, java内存管理,指的是线程管理,保证线程安全
2. volatle and synchorozed
volatile is lightwweight, only variable while synchonzied is heavy. for variable and method.
volatile 只保证可见性,不保证原子性,要保证原子性需要AtomicInteger. Synchorined 都保证。
static单例
3. thread local