|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Promise<T>
A unifying future-like interface to dataflow variables, asynchronous functions and active objects.
Method Summary | |
---|---|
T |
get()
Retrieves the value of the variable, blocking until a value is available |
T |
get(long timeout,
java.util.concurrent.TimeUnit units)
Retrieves the value of the variable, blocking up to given timeout, if the value has not been assigned yet. |
T |
getVal()
Reads the current value of the channel. |
T |
getVal(long timeout,
java.util.concurrent.TimeUnit units)
Reads the current value of the channel. |
void |
getValAsync(MessageStream callback)
Asynchronously retrieves the value from the channel. |
void |
getValAsync(java.lang.Object attachment,
MessageStream callback)
Asynchronously retrieves the value from the channel. |
boolean |
isBound()
Check if value has been set already for this expression |
void |
rightShift(groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data became available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled |
void |
whenBound(groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data becomes available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled. |
void |
whenBound(MessageStream stream)
Send the bound data to provided stream when it becomes available |
void |
whenBound(groovyx.gpars.group.PGroup group,
groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data becomes available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled. |
void |
whenBound(Pool pool,
groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data becomes available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled. |
Method Detail |
---|
T get() throws java.lang.Throwable
java.lang.Throwable
- If the stored value is an exception instance it gets re-thrownT get(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.Throwable
timeout
- The timeout valueunits
- Units for the timeout
java.lang.Throwable
- If the stored value is an exception instance it gets re-thrownvoid getValAsync(MessageStream callback)
callback
- An actor to send the bound value to.void getValAsync(java.lang.Object attachment, MessageStream callback)
attachment
- arbitrary non-null attachment if reader needs better identification of resultcallback
- An actor to send the bound value plus the supplied index to.T getVal() throws java.lang.InterruptedException
java.lang.InterruptedException
- If the current thread gets interrupted while waiting for the channel to be boundT getVal(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.InterruptedException
timeout
- The timeout valueunits
- Units for the timeout
java.lang.InterruptedException
- If the current thread gets interrupted while waiting for the channel to be boundvoid rightShift(groovy.lang.Closure closure)
closure
- closure to execute when data availablevoid whenBound(groovy.lang.Closure closure)
closure
- closure to execute when data availablevoid whenBound(Pool pool, groovy.lang.Closure closure)
pool
- The thread pool to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data availablevoid whenBound(groovyx.gpars.group.PGroup group, groovy.lang.Closure closure)
group
- The PGroup to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data availablevoid whenBound(MessageStream stream)
stream
- stream where to send resultboolean isBound()
|
Copyright © 2008–2010 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |