1. /*
  2. * @(#)Future.java 1.6 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.internal.core ;
  8. import com.sun.corba.se.internal.core.Closure ;
  9. public class Future implements Closure {
  10. private boolean evaluated ;
  11. private Closure closure ;
  12. private Object value ;
  13. public Future( Closure value )
  14. {
  15. this.evaluated = false ;
  16. this.closure = (Closure)value ;
  17. this.value = null ;
  18. }
  19. public synchronized Object evaluate()
  20. {
  21. if (!evaluated) {
  22. evaluated = true ;
  23. value = closure.evaluate() ;
  24. }
  25. return value ;
  26. }
  27. }