forked from gooddata/gooddata-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFutureResult.java
More file actions
47 lines (41 loc) · 1.23 KB
/
FutureResult.java
File metadata and controls
47 lines (41 loc) · 1.23 KB
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
40
41
42
43
44
45
46
47
/*
* Copyright (C) 2004-2017, GoodData(R) Corporation. All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
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
*/
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
*/
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
*/
T get(final long timeout, final TimeUnit unit);
/**
* Get URI used for polling
*
* @return URI string
*/
String getPollingUri();
}