net.gdface.utils.BaseVolatile Maven / Gradle / Ivy
package net.gdface.utils;
/**
* 基于volatile的双重检查锁定实现{@link ILazyInitVariable}的抽象类
* 原理说明参见《The "Double-Checked Locking is Broken" Declaration》
* 要求 JDK5 以上版本
* @author guyadong
*
* @param variable type
*/
public abstract class BaseVolatile extends ILazyInitVariable.VolatileVar{
@Override
protected final T in(T t) {
return t;
}
@Override
protected final T out(T var) {
return var;
}
}