定时任务支持并发控制
This commit is contained in:
@ -22,7 +22,7 @@ public class Global
|
||||
/**
|
||||
* 当前对象实例
|
||||
*/
|
||||
private static Global global = null;
|
||||
private static Global global;
|
||||
|
||||
/**
|
||||
* 保存全局属性值
|
||||
@ -34,18 +34,13 @@ public class Global
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态工厂方法 获取当前对象实例 多线程安全单例模式(使用双重同步锁)
|
||||
* 静态工厂方法
|
||||
*/
|
||||
|
||||
public static synchronized Global getInstance()
|
||||
{
|
||||
if (global == null)
|
||||
{
|
||||
synchronized (Global.class)
|
||||
{
|
||||
if (global == null)
|
||||
global = new Global();
|
||||
}
|
||||
global = new Global();
|
||||
}
|
||||
return global;
|
||||
}
|
||||
|
Reference in New Issue
Block a user