PromiseList (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## grails.async
[Groovy] Class PromiseList

    java.lang.Object
      grails.async.PromiseList

All Implemented Interfaces:
  Promise

    @groovy.transform.CompileStatic
    class PromiseList
    extends java.lang.Object

A list of promises

Authors:
  Graeme Rocher

Since:
  2.3

Field Summary
`protected java.util.List` | `promises`

Method Summary
`boolean` | `add(java.lang.Object value)` Implementation of add that adds any value as a bound promise
`boolean` | `add(groovy.lang.Closure callable)` Implementation of add that takes a closure and creates a promise, adding it to the list
`boolean` | `add(Promise p)` Implementation of add that takes a promise, adding it to the list
`java.util.List` | `get()` Synchronously obtains all the values from all the promises
`java.util.List` | `get(long timeout, java.util.concurrent.TimeUnit units)`
`PromiseList` | `leftShift(groovy.lang.Closure callable)` Add a promise to the promise list
`PromiseList` | `leftShift(java.lang.Object value)` Add a value as a bound promise to the list of values
`PromiseList` | `leftShift(Promise p)` Add a promise to the promise list
`Promise` | `onComplete(groovy.lang.Closure callable)` Execute the given closure when all promises are complete
`Promise` | `onError(groovy.lang.Closure callable)`
`Promise` | `then(groovy.lang.Closure callable)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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()

Field Detail

### promises

    protected java.util.List promises

Method Detail

### add

    boolean add(java.lang.Object value)

  Implementation of add that adds any value as a bound promise
  Parameters:
    `callable` - The callable
  Returns:
    True if it was added

### add

    boolean add(groovy.lang.Closure callable)

  Implementation of add that takes a closure and creates a promise, adding it to the list
  Parameters:
    `callable` - The callable
  Returns:
    True if it was added

### add

    boolean add(Promise p)

  Implementation of add that takes a promise, adding it to the list
  Parameters:
    `callable` - The callable
  Returns:
    True if it was added

### get

    java.util.List get()

  Synchronously obtains all the values from all the promises
  Returns:
    The values

### get

    @java.lang.Override
    java.util.List get(long timeout, java.util.concurrent.TimeUnit units)

### leftShift

    PromiseList leftShift(groovy.lang.Closure callable)

  Add a promise to the promise list
  Parameters:
    `callable` - The callable
  Returns:
    The promise list

### leftShift

    PromiseList leftShift(java.lang.Object value)

  Add a value as a bound promise to the list of values
  Parameters:
    `callable` - The callable
  Returns:
    The promise list

### leftShift

    PromiseList leftShift(Promise p)

  Add a promise to the promise list
  Parameters:
    `callable` - The callable
  Returns:
    The promise list

### onComplete

    @java.lang.SuppressWarnings("unchecked")
    Promise onComplete(groovy.lang.Closure callable)

  Execute the given closure when all promises are complete
  Parameters:
    `callable` - The callable

### onError

    @java.lang.SuppressWarnings("unchecked")
    Promise onError(groovy.lang.Closure callable)

### then

    @java.lang.SuppressWarnings("unchecked")
    Promise then(groovy.lang.Closure callable)

Groovy Documentation