DCAE-D be initial commit
[sdc/dcae-d/dt-be-main.git] / dcaedt_catalog / commons / src / main / java / org / onap / sdc / dcae / catalog / commons / Future.java
1 package org.onap.sdc.dcae.catalog.commons;
2
3 import org.onap.sdc.dcae.catalog.commons.Future;
4 import org.onap.sdc.dcae.catalog.commons.FutureHandler;
5
6 /**
7  * Modeled after the vertx future
8  */
9 public interface Future<T> {
10
11         public T result();
12         
13         public Future<T> result(T theResult);
14
15 //rename 'cause' to 'failure'
16         
17         public Throwable cause();
18                 
19         public Future<T> cause(Throwable theError);
20         
21         public boolean succeeded();
22
23         public boolean failed();
24
25         public boolean complete();
26
27         public T waitForResult() throws Exception;
28         
29         //public T waitForResult(long theTimeout) throws Exception;
30
31         public Future<T> waitForCompletion() throws InterruptedException;
32         
33         public Future<T> setHandler(FutureHandler<T> theHandler);
34
35 }