Ejemplo n.º 1
0
 private T getInternal() {
   T result = instance;
   if (null == result) {
     instance = result = creation.call();
   }
   return result;
 }
Ejemplo n.º 2
0
 private T getInternalSync() {
   T result = instance;
   if (null == result) {
     synchronized (this) {
       result = instance;
       if (null == result) {
         instance = result = creation.call();
       }
     }
   }
   return result;
 }