|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgroovyx.gpars.dataflow.stream.DataflowStreamReadAdapter<T>
groovyx.gpars.dataflow.SyncDataflowStreamReadAdapter<T>
T - The type of messages to pass through the streamfinal class SyncDataflowStreamReadAdapter<T>
Provides a special implementation of DataflowStreamReadAdapter, which cooperates with SyncDataflowBroadcast subscription and un-subscription mechanism.
| Field Summary | |
|---|---|
private boolean |
closed
|
private boolean |
wheneverBoundSet
|
| Constructor Summary | |
|---|---|
SyncDataflowStreamReadAdapter(StreamCore<T> stream)
Creates a new adapter |
|
| Method Summary | ||
|---|---|---|
(package private) void |
close()
Closes the channel so that it cannot be used any longer |
|
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. |
|
|
chainWith(PGroup group,
groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel |
|
private void |
checkClosed()
|
|
boolean |
isBound()
Check if value has been set already for this expression |
|
java.util.Iterator<T> |
iterator()
|
|
|
merge(PGroup group,
java.util.List<DataflowReadChannel<java.lang.Object>> others,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator. |
|
DataflowExpression<T> |
poll()
Retrieves the value at the head of the buffer. |
|
|
rightShift(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data became available. |
|
DataflowReadChannel<T> |
tap(PGroup group,
DataflowWriteChannel<T> target)
Taps into the pipeline. |
|
|
whenBound(groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
void |
whenBound(MessageStream stream)
Send the bound data to provided stream when it becomes available |
|
|
whenBound(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available. |
|
|
whenBound(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor after data becomes available. |
|
|
wheneverBound(groovy.lang.Closure<V> closure)
Send all pieces of data bound in the future to the provided stream when it becomes available |
|
void |
wheneverBound(MessageStream stream)
Send all pieces of data bound in the future to the provided stream when it becomes available. |
|
| Methods inherited from class groovyx.gpars.dataflow.stream.DataflowStreamReadAdapter |
|---|
allUnprocessedDFVs, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, filter, filter, filter, filter, filter, filter, getEventManager, chainWith, chainWith, chainWith, chainWith, chainWith, choice, choice, choice, choice, choice, choice, into, into, into, into, into, into, length, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, or, or, separate, separate, separate, separate, separate, separate, split, split, split, split, split, split, split, split, split, split, split, split, tap, tap, tap, tap, tap, then, then, then, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private boolean closed
private boolean wheneverBoundSet
| Constructor Detail |
|---|
SyncDataflowStreamReadAdapter(StreamCore<T> stream)
stream - The stream to wrap| Method Detail |
|---|
public java.util.Iterator<T> iterator()
iterator in class DataflowStreamReadAdapter<T>
public T getVal()
throws java.lang.InterruptedException
DataflowReadChannel
getVal in interface DataflowReadChannel<T>getVal in class DataflowStreamReadAdapter<T>java.lang.InterruptedException - If the current thread gets interrupted while waiting for the channel to be bound
public T getVal(long timeout,
java.util.concurrent.TimeUnit units)
throws java.lang.InterruptedException
DataflowReadChannel
getVal in interface DataflowReadChannel<T>getVal in class DataflowStreamReadAdapter<T>timeout - The timeout valueunits - Units for the timeout
java.lang.InterruptedException - If the current thread gets interrupted while waiting for the channel to be boundpublic void getValAsync(MessageStream callback)
DataflowReadChannel
getValAsync in interface DataflowReadChannel<T>getValAsync in class DataflowStreamReadAdapter<T>callback - An actor to send the bound value to.
public void getValAsync(java.lang.Object attachment,
MessageStream callback)
DataflowReadChannel
getValAsync in interface DataflowReadChannel<T>getValAsync in class DataflowStreamReadAdapter<T>attachment - arbitrary non-null attachment if reader needs better identification of resultcallback - An actor to send the bound value plus the supplied index to.public <V> Promise<V> rightShift(groovy.lang.Closure<V> closure)
DataflowReadChannel
rightShift in interface DataflowReadChannel<T>rightShift in class DataflowStreamReadAdapter<T>closure - closure to execute when data becomes available. The closure should take at most one argument.
public <V> void whenBound(groovy.lang.Closure<V> closure)
DataflowReadChannel
whenBound in interface DataflowReadChannel<T>whenBound in class DataflowStreamReadAdapter<T>closure - closure to execute when data becomes available. The closure should take at most one argument.
public <V> void whenBound(Pool pool,
groovy.lang.Closure<V> closure)
whenBound in interface DataflowReadChannel<T>whenBound in class DataflowStreamReadAdapter<T>pool - The thread pool to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.
public <V> void whenBound(PGroup group,
groovy.lang.Closure<V> closure)
DataflowReadChannel
whenBound in interface DataflowReadChannel<T>whenBound in class DataflowStreamReadAdapter<T>group - The PGroup to use for task scheduling for asynchronous message deliveryclosure - closure to execute when data becomes available. The closure should take at most one argument.public void whenBound(MessageStream stream)
DataflowReadChannel
whenBound in interface DataflowReadChannel<T>whenBound in class DataflowStreamReadAdapter<T>stream - stream where to send resultpublic <V> void wheneverBound(groovy.lang.Closure<V> closure)
DataflowReadChannel
wheneverBound in interface DataflowReadChannel<T>wheneverBound in class DataflowStreamReadAdapter<T>closure - closure to execute when data becomes available. The closure should take at most one argument.public void wheneverBound(MessageStream stream)
DataflowReadChannel
wheneverBound in interface DataflowReadChannel<T>wheneverBound in class DataflowStreamReadAdapter<T>stream - stream where to send result
public <V> DataflowReadChannel<V> chainWith(PGroup group,
groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith in interface DataflowReadChannel<T>chainWith in class DataflowStreamReadAdapter<T>V - The type of values returned from the supplied closuregroup - The PGroup to useclosure - The function to invoke on all incoming values as part of the new operator's body
public DataflowReadChannel<T> tap(PGroup group,
DataflowWriteChannel<T> target)
DataflowReadChannel
tap in interface DataflowReadChannel<T>tap in class DataflowStreamReadAdapter<T>group - The PGroup to usetarget - The channel to tap data into
public <V> DataflowReadChannel<V> merge(PGroup group,
java.util.List<DataflowReadChannel<java.lang.Object>> others,
groovy.lang.Closure<V> closure)
DataflowReadChannel
merge in interface DataflowReadChannel<T>merge in class DataflowStreamReadAdapter<T>V - The type of values passed between the channelsgroup - The PGroup to useothers - The channels to merge withclosure - The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.
public boolean isBound()
DataflowReadChannel
isBound in interface DataflowReadChannel<T>isBound in class DataflowStreamReadAdapter<T>
public DataflowExpression<T> poll()
throws java.lang.InterruptedException
DataflowReadChannel
poll in interface DataflowReadChannel<T>poll in class DataflowStreamReadAdapter<T>java.lang.InterruptedException - If the current thread is interruptedprivate void checkClosed()
void close()
throws java.lang.InterruptedException
java.lang.InterruptedException - When the thread gets interrupted
|
Copyright © 2008–2012 Václav Pech. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||