org.codehaus.gpars

groovyx.gpars.dataflow.stream
[Java] Class DataflowStreamReadAdapter

java.lang.Object
  groovyx.gpars.dataflow.stream.DataflowStreamReadAdapter
All Implemented Interfaces:
DataflowReadChannel

public final class DataflowStreamReadAdapter
extends java.lang.Object

Adapts a DataflowStream to accommodate for the DataflowReadChannel interface. To minimize the overhead and stay in-line with the DataflowStream semantics, the DataflowStreamReadAdapter class is not thread-safe and should only be used from within a single thread. If multiple threads need to read from a DataflowStream, they should each create their own wrapping DataflowStreamReadAdapter.

Parameters:
- The type of messages to pass through the stream
Authors:
Vaclav Pech


Field Summary
private DataflowStream asyncHead

private DataflowStream head

 
Constructor Summary
DataflowStreamReadAdapter(DataflowStream stream)

Creates a new adapter

 
Method Summary
T getVal()

T getVal(long timeout, java.util.concurrent.TimeUnit units)

void getValAsync(MessageStream callback)

void getValAsync(java.lang.Object attachment, MessageStream callback)

boolean isBound()

java.util.Iterator iterator()

private void moveAsyncHead()

private void moveHead()

DataflowExpression poll()

void rightShift(groovy.lang.Closure closure)

java.lang.String toString()

void whenBound(groovy.lang.Closure closure)

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.

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

void whenBound(MessageStream stream)

void wheneverBound(groovy.lang.Closure closure)

void wheneverBound(MessageStream stream)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

asyncHead

private DataflowStream asyncHead


head

private DataflowStream head


 
Constructor Detail

DataflowStreamReadAdapter

public DataflowStreamReadAdapter(DataflowStream stream)
Creates a new adapter
Parameters:
stream - The stream to wrap


 
Method Detail

getVal

@Override
public T getVal()


getVal

@Override
public T getVal(long timeout, java.util.concurrent.TimeUnit units)


getValAsync

@Override
public void getValAsync(MessageStream callback)


getValAsync

@Override
public void getValAsync(java.lang.Object attachment, MessageStream callback)


isBound

@Override
public boolean isBound()


iterator

public java.util.Iterator iterator()


moveAsyncHead

private void moveAsyncHead()


moveHead

private void moveHead()


poll

@Override
public DataflowExpression poll()


rightShift

@Override
public void rightShift(groovy.lang.Closure closure)


toString

@Override
public java.lang.String toString()


whenBound

@Override
public void whenBound(groovy.lang.Closure closure)


whenBound

@Override
public 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.
Parameters:
pool - The thread pool to use for task scheduling for asynchronous message delivery
closure - closure to execute when data available


whenBound

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


whenBound

@Override
public void whenBound(MessageStream stream)


wheneverBound

@Override
public void wheneverBound(groovy.lang.Closure closure)


wheneverBound

@Override
public void wheneverBound(MessageStream stream)


 

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