1.使用软件
idea2018.3
2.代码
public class SingletonDebug {
private static SingletonDebug singletionDebug;
private SingletonDebug(){
}
public static SingletonDebug getInstance(){
if (singletionDebug == null){
singletionDebug = new SingletonDebug();
}
return singletionDebug;
}
}
public class T implements Runnable {
@Override
public void run() {
SingletonDebug singletonDebug = SingletonDebug.getInstance();
System.out.println(singletonDebug.hashCode());
}
}
public class Main {
public static void main(String[] args) {
Thread t1 = new Thread(new T());
Thread t2 = new Thread(new T());
t1.start();
t2.start();
System.out.println("end of main");
}
}
3.断点位置
4.debug方式
主要使用多线程debug的方式重现一个问题。多线程的时候,如何复现问题。