org.codehaus.gpars

groovyx.gpars.dataflow
[Java] Interface Promise

groovyx.gpars.dataflow.SelectableChannel
  groovyx.gpars.dataflow.Promise
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)

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

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

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

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

Checks if the promise is bound to an error

Promise thenForkAndJoin(groovy.lang.Closure... closures)

May be used by lazy implementations to warm up

Promise thenForkAndJoin(Pool pool, groovy.lang.Closure... closures)

Promise thenForkAndJoin(PGroup group, groovy.lang.Closure... closures)

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

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


get

@java.lang.SuppressWarnings* 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)


then

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


then

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


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)
Checks if the promise is bound to an error
Returns:
True, if an error has been bound


thenForkAndJoin

public Promise thenForkAndJoin(groovy.lang.Closure... closures)
May be used by lazy implementations to warm up


thenForkAndJoin

public Promise thenForkAndJoin(Pool pool, groovy.lang.Closure... closures)


thenForkAndJoin

public Promise thenForkAndJoin(PGroup group, groovy.lang.Closure... closures)


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.