单件模式是非线程安全的: // Single threaded version class Foo { private Helper helper = null; public Helper getHelper() { if (helper == null) { helper = new Helper(); } return helper; } // other functions and members... } 这段在使用多线程的情况下无法正常工作.在多个线程同时调用getHelper()时…