uk.org.ogsadai.activity
Class SynchronizedGrowableExternalPipe

java.lang.Object
  |
  +--uk.org.ogsadai.activity.SynchronizedGrowableExternalPipe
All Implemented Interfaces:
BlockReader, BlockWriter, Pipe

public class SynchronizedGrowableExternalPipe
extends java.lang.Object
implements Pipe

This is a pipe designed to be shared between multiple writer threads and a single reader thread.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static DAILogger LOG
          Logger object for logging in this class
private  boolean mClosed
          Set to true when the pipe is closed.
private  java.util.List mData
          Stores the blocks that are put onto the pipe.
private  ProcessingStatus mStatus
          The status of the request containing the activity the has the pipe.
 
Constructor Summary
SynchronizedGrowableExternalPipe(ProcessingStatus status)
          Creates a new pipe for an input of an activity contained in the specified request.
 
Method Summary
 void close()
          Closes the block writer to indicate that there are no more blocks are to be written.
 boolean hasNext()
          Indicates whether or not there are any more blocks of data to be read from the block reader.
 boolean isOpen()
          Indicates whether or not the block writer is open for writing via the put method.
 java.lang.Object next()
          Gets the next block of data contained in the block reader.
 void put(java.lang.Object block)
          Writes the specified block of output data.
 void waitForBlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

LOG

private static final DAILogger LOG
Logger object for logging in this class


mData

private final java.util.List mData
Stores the blocks that are put onto the pipe.


mClosed

private boolean mClosed
Set to true when the pipe is closed.


mStatus

private ProcessingStatus mStatus
The status of the request containing the activity the has the pipe.

Constructor Detail

SynchronizedGrowableExternalPipe

public SynchronizedGrowableExternalPipe(ProcessingStatus status)
Creates a new pipe for an input of an activity contained in the specified request.

Parameters:
status - the status of the request containing the activity that created the pipe
Method Detail

next

public java.lang.Object next()
Description copied from interface: BlockReader
Gets the next block of data contained in the block reader.

Specified by:
next in interface BlockReader
Returns:
an Object
See Also:
BlockReader.next()

close

public void close()
Description copied from interface: BlockWriter
Closes the block writer to indicate that there are no more blocks are to be written. After close has been called, the put method should no longer be used.

Specified by:
close in interface BlockWriter

put

public void put(java.lang.Object block)
Description copied from interface: BlockWriter
Writes the specified block of output data.

Specified by:
put in interface BlockWriter
Parameters:
block - the Object block to write
Throws:
PipeAccessException - is there is an attempt to put data into the pipe before the associated request has begun processing
See Also:
BlockWriter.put(Object)

hasNext

public boolean hasNext()
Description copied from interface: BlockReader
Indicates whether or not there are any more blocks of data to be read from the block reader.

Specified by:
hasNext in interface BlockReader
Returns:
true if there are more blocks to be read or false otherwise

waitForBlock

public void waitForBlock()

isOpen

public boolean isOpen()
Description copied from interface: BlockWriter
Indicates whether or not the block writer is open for writing via the put method. After the close method has been invoked this method should return false.

Specified by:
isOpen in interface BlockWriter
Returns:
A boolean value indicating whether this block writer is open for writing