View Javadoc

1   package cz.cuni.amis.utils.future;
2   
3   import java.util.concurrent.TimeUnit;
4   
5   /**
6    * Future implementation that holds fixed result.
7    */
8   public class FixedFuture<Result> implements IFuture<Result> {
9   	
10  	private Result result;
11  	
12  	public FixedFuture(Result result) {
13  		this.result = result;
14  	}
15  	
16  	@Override
17  	public boolean cancel(boolean mayInterruptIfRunning) {
18  		return false;
19  	}
20  
21  	@Override
22  	public Result get() {
23  		return result;
24  	}
25  
26  	@Override
27  	public Result get(long timeout, TimeUnit unit) {
28  		return result;
29  	}
30  
31  	@Override
32  	public boolean isCancelled() {
33  		return false;
34  	}
35  
36  	@Override
37  	public boolean isDone() {
38  		return true;
39  	}	
40  
41  }