public class DCL {
private static DCL staticDcl;
private final DCL finalDcl;
private DCL(){
//other init operation
//the action must be last.
finalDcl = this;
}
public static DCL getDCL() {
if (staticDcl == null) {
synchronized(DCL.class) {
if (staticDcl == null) {
staticDcl = new DCL();
}
}
}
return staticDcl.finalDcl;
}
}
can the above code run without any error in multithreading environment??
I want to use the key word final to implements the dcl not volatitle.