我有一个春季服务类: @Service
public class MyService {
private boolean flag = false;
public void method1() {
if(!flag)
// do something
flag = true;
}
public void method2()
public class ThreadVolatilePerfectExample2 {
public static boolean stop = false; // not volatile
public static void main(String args[]) throws InterruptedException {
Thread testThread