org.codehaus.gpars

groovyx.gpars.dataflow
[Java] Interface Promise

groovyx.gpars.dataflow.Promise
  groovyx.gpars.dataflow.SelectableChannel
All Superinterfaces:
SelectableChannel

public interface Promise
extends SelectableChannel

A unifying future-like interface to dataflow variables, asynchronous functions and active objects. Represents the read end of DataflowVariables.

Authors:
Vaclav Pech


Method Summary
java.lang.Object get()

java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)

java.lang.Throwable getError()

boolean isBound()

boolean isError()

void join()

// * Reads the current value of the channel.

void join(long timeout, java.util.concurrent.TimeUnit units)

Schedule closure to be executed after data became available.

Promise rightShift(groovy.lang.Closure closure)

Promise then(groovy.lang.Closure closure)

Promise then(Pool pool, groovy.lang.Closure closure)

Check if value has been set already for this expression

Promise then(PGroup group, groovy.lang.Closure closure)

Promise then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)

May be used by lazy implementations to warm up

Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)

Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)

void touch()

void whenBound(groovy.lang.Closure closure)

void whenBound(Pool pool, groovy.lang.Closure closure)

void whenBound(PGroup group, groovy.lang.Closure closure)

void whenBound(MessageStream stream)

 
Methods inherited from interface SelectableChannel
poll, wheneverBound, wheneverBound
 

Method Detail

get

* Asynchronously retrieves the value from the channel. Sends the actual value of the channel as a message
//
public java.lang.Object get()


get

* with a map holding the supplied attachment under the 'attachment' key and the actual value of the channel under
//
public java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)


getError

public java.lang.Throwable getError()


isBound

public boolean isBound()


isError

public boolean isError()


join

public void join()
// * Reads the current value of the channel. Blocks, if the value has not been assigned yet. // * // *
throws:
InterruptedException If the current thread gets interrupted while waiting for the channel to be bound //
Returns:
The actual value // *


join

public void join(long timeout, java.util.concurrent.TimeUnit units)
Schedule closure to be executed after data became available. It is important to notice that even if the expression is already bound the execution of closure will not happen immediately but will be scheduled
Parameters:
closure - closure to execute when data becomes available. The closure should take at most one argument.
Returns:
A promise for the results of the supplied closure. This allows for chaining of then() method calls.


rightShift

public Promise rightShift(groovy.lang.Closure closure)


then

public Promise then(groovy.lang.Closure closure)


then

public Promise then(Pool pool, groovy.lang.Closure closure)
Check if value has been set already for this expression
Returns:
true if bound already


then

public Promise then(PGroup group, groovy.lang.Closure closure)


then

public Promise then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
May be used by lazy implementations to warm up


then

public Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)


then

public Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)


touch

public void touch()


whenBound

public void whenBound(groovy.lang.Closure closure)


whenBound

public void whenBound(Pool pool, groovy.lang.Closure closure)


whenBound

public void whenBound(PGroup group, groovy.lang.Closure closure)


whenBound

public void whenBound(MessageStream stream)


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.