1 18 package org.apache.geronimo.interop.util; 19 20 24 public abstract class FutureObject { 25 private static final boolean _volatileIsEffectiveMemoryBarrier = MemoryBarrier.USE_VOLATILE; 26 27 private volatile boolean _evaluated = false; 28 29 private Object _value; 30 31 35 public abstract Object evaluate(); 36 37 public final Object getValue() { 38 if (_volatileIsEffectiveMemoryBarrier) { 39 if (!_evaluated) { 40 synchronized (this) { 41 if (!_evaluated) { 42 _value = evaluate(); 43 _evaluated = true; 44 } 45 } 46 } 47 } else { 48 synchronized (this) { 49 if (!_evaluated) { 50 _value = evaluate(); 51 _evaluated = true; 52 } 53 } 54 } 55 return _value; 56 } 57 } 58 | Popular Tags |