@groovy.transform.AutoFinal @groovy.transform.CompileStatic class PromiseMap<K, V> extends java.lang.Object implements Promise<java.util.Map<K, V>>
A map-like structure for promises that allows waiting for all values in the map to be populated before executing a callback
Modifiers | Name | Description |
---|---|---|
protected java.util.LinkedHashMap<K, Promise<V>> |
promises |
|
protected java.util.LinkedHashMap<Promise<V>, K> |
promisesKeys |
Constructor and description |
---|
PromiseMap
() |
PromiseMap
(java.util.Map<K, V> values) |
Type Params | Return Type | Name and description |
---|---|---|
|
Promise<java.util.Map<K, V>> |
accept(java.util.Map<K, V> values) |
|
boolean |
cancel(boolean mayInterruptIfRunning) |
|
boolean |
containsKey(K key)
|
|
Promise<V> |
get(K key) Gets a promise instance for the given key |
|
java.util.Map<K, V> |
get() Synchronously return the populated map with all values obtained from promises used inside the populated map |
|
java.util.Map<K, V> |
get(long timeout, java.util.concurrent.TimeUnit units) Synchronously return the populated map with all values obtained from promises used inside the populated map |
|
Promise<V> |
getAt(K key) Gets a promise instance for the given key |
|
boolean |
isCancelled() |
|
boolean |
isDone() |
|
boolean |
isEmpty()
|
|
Promise<java.util.Map<K, V>> |
leftShift(groovy.lang.Closure callable) |
|
Promise<java.util.Map<K, V>> |
onComplete(groovy.lang.Closure<java.util.Map<K, V>> callable) |
|
Promise<java.util.Map<K, V>> |
onError(groovy.lang.Closure<java.util.Map<K, V>> callable) |
|
Promise<V> |
put(K key, V value) Put any value and return a promise for that value |
|
Promise<V> |
put(K key, Promise<V> promise) Adds a promise for the given key |
|
Promise<V> |
put(K key, groovy.lang.Closure<V> callable) Adds a callable for the given key |
|
Promise<V> |
putAt(java.lang.String key, Promise<V> promise) Adds a promise for the given key |
|
Promise<V> |
putAt(java.lang.String key, groovy.lang.Closure<V> callable) Adds a callable for the given key |
|
Promise<V> |
putAt(java.lang.String key, V value) Adds a value for the given key |
|
Promise<V> |
putAt(java.lang.Integer key, Promise<V> promise) Adds a promise for the given key |
|
Promise<V> |
putAt(java.lang.Integer key, groovy.lang.Closure<V> callable) Adds a promise for the given key |
|
int |
size()
|
|
Promise<java.util.Map<K, V>> |
then(groovy.lang.Closure<java.util.Map<K, V>> callable) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
key
- The keyGets a promise instance for the given key
o
- The keySynchronously return the populated map with all values obtained from promises used inside the populated map
Synchronously return the populated map with all values obtained from promises used inside the populated map
timeout
- The timeout periodunits
- The timeout unitsGets a promise instance for the given key
key
- The key
Put any value and return a promise for that value
key
- The keyvalue
- The valueAdds a promise for the given key
key
- The keypromise
- The promiseAdds a callable for the given key
key
- The keycallable
- The closure to callAdds a promise for the given key
key
- The keypromise
- The promiseAdds a callable for the given key
key
- The keycallable
- The closure to callAdds a value for the given key
key
- The keyvalue
- The valueAdds a promise for the given key
key
- The keypromise
- The promiseAdds a promise for the given key
key
- The keycallable
- The closure to call