forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FutureResult.java
39 lines (33 loc) · 1.02 KB
/
FutureResult.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved.
*/
package com.gooddata;
import java.util.concurrent.TimeUnit;
/**
* Represents the result retrieved by polling on the REST API.
*/
public interface FutureResult<T> {
/**
* Checks if the result is available
*
* @return true if so
* @throws GoodDataException when polling fails or the thread was interrupted
*/
public boolean isDone();
/**
* Wait for the result to be available and return it's value
*
* @return result value
* @throws GoodDataException when polling fails or the thread was interrupted
*/
public T get();
/**
* Wait for the result to be available up to given time and return it's value
*
* @param timeout timeout value
* @param unit timeout unit
* @return result value
* @throws GoodDataException when polling fails, the timeout expires or the thread was interrupted
*/
public T get(final long timeout, final TimeUnit unit);
}