T
- The type of messages to pass through the streamfinal class SyncDataflowStreamReadAdapter<T> extends DataflowStreamReadAdapter<T>
Modifier and Type | Field and Description |
---|---|
private boolean |
closed |
private boolean |
wheneverBoundSet |
Constructor and Description |
---|
SyncDataflowStreamReadAdapter(StreamCore<T> stream)
Creates a new adapter
|
Modifier and Type | Method and Description |
---|---|
<V> DataflowReadChannel<V> |
chainWith(PGroup group,
groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel
|
private void |
checkClosed() |
(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.
|
boolean |
isBound()
Check if value has been set already for this expression
|
java.util.Iterator<T> |
iterator() |
<V> DataflowReadChannel<V> |
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.
|
<V> Promise<V> |
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.
|
<V> void |
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
|
<V> void |
whenBound(PGroup group,
groovy.lang.Closure<V> closure)
Schedule closure to be executed after data becomes available.
|
<V> void |
whenBound(Pool pool,
groovy.lang.Closure<V> closure)
Schedule closure to be executed by pooled actor after data becomes available.
|
<V> void |
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.
|
allUnprocessedDFVs, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, chainWith, chainWith, chainWith, chainWith, chainWith, choice, choice, choice, choice, choice, choice, filter, filter, filter, filter, filter, filter, getEventManager, 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
SyncDataflowStreamReadAdapter(StreamCore<T> stream)
stream
- The stream to wrappublic 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 boundpublic 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 timeoutjava.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() redefines the >> operator so you can write df >> {println it} instead of df.whenBound{println it}
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)
SelectableChannel
wheneverBound
in interface SelectableChannel<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)
SelectableChannel
wheneverBound
in interface SelectableChannel<T>
wheneverBound
in class DataflowStreamReadAdapter<T>
stream
- stream where to send resultpublic <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 bodypublic 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 intopublic <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
SelectableChannel
poll
in interface SelectableChannel<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