KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orbutil > closure > Future


1 /*
2  * @(#)Future.java 1.9 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.orbutil.closure ;
9
10 import com.sun.corba.se.spi.orbutil.closure.Closure ;
11
12 public class Future implements Closure {
13     private boolean evaluated ;
14     private Closure closure ;
15     private Object JavaDoc value ;
16
17     public Future( Closure value )
18     {
19     this.evaluated = false ;
20     this.closure = (Closure)value ;
21     this.value = null ;
22     }
23     
24     public synchronized Object JavaDoc evaluate()
25     {
26     if (!evaluated) {
27         evaluated = true ;
28         value = closure.evaluate() ;
29     }
30
31     return value ;
32     }
33 }
34
Popular Tags