public class FutureManager<K,C>
extends java.lang.Object
Constructor and Description |
---|
FutureManager() |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future<C> |
acquireOrGet(K key)
retrieve an existing future for the key, or create a new one for it if
absent
|
java.util.concurrent.Future<C> |
get(K key) |
boolean |
hasFuture(K key) |
protected ListenableFuture<C> |
newFuture()
override if you want to use an extended version of managed future
|
java.util.concurrent.Future<C> |
release(K key,
C result)
release the future by setting the result
|
java.util.concurrent.Future<C> |
release(K key,
java.lang.Throwable exception)
release the future by setting the exception
|
public boolean hasFuture(K key)
public java.util.concurrent.Future<C> acquireOrGet(K key)
key
- public java.util.concurrent.Future<C> release(K key, C result)
key
- result
- public java.util.concurrent.Future<C> release(K key, java.lang.Throwable exception)
key
- exception
- protected ListenableFuture<C> newFuture()