org.pentaho.di.core
Class BlockingRowSet

java.lang.Object
  extended by org.pentaho.di.core.BlockingRowSet
All Implemented Interfaces:
Comparable<RowSet>, RowSet

public class BlockingRowSet
extends Object
implements Comparable<RowSet>, RowSet

Contains a buffer of rows. Getting rows from the buffer or putting rows in the buffer is synchronized to allow concurrent use of multiple Threads.

Since:
04-04-2003
Author:
Matt

Constructor Summary
BlockingRowSet(int maxSize)
          Create new non-blocking-queue with maxSize capacity.
 
Method Summary
 int compareTo(RowSet rowSet)
          Compares using the target steps and copy, not the source.
 boolean equals(org.pentaho.di.core.BaseRowSet rowSet)
           
 int getDestinationStepCopy()
           
 String getDestinationStepName()
           
 String getName()
           
 int getOriginStepCopy()
           
 String getOriginStepName()
           
 String getRemoteSlaveServerName()
           
 Object[] getRow()
          Get a row from the input buffer, it blocks for a short period until a new row becomes available.
 Object[] getRowImmediate()
          Get the first row in the list immediately.
 RowMetaInterface getRowMeta()
           
 Object[] getRowWait(long timeout, TimeUnit tu)
          get the first row in the list immediately if it is available or wait until timeout
 boolean isBlocking()
          By default we don't report blocking, only for monitored transformations.
 boolean isDone()
           
 boolean putRow(RowMetaInterface rowMeta, Object[] rowData)
          Offer a row of data to this rowset providing for the description (metadata) of the row.
 boolean putRowWait(RowMetaInterface rowMeta, Object[] rowData, long time, TimeUnit tu)
          Offer a row of data to this rowset providing for the description (metadata) of the row.
 void setDone()
           
 void setRemoteSlaveServerName(String remoteSlaveServerName)
           
 void setRowMeta(RowMetaInterface rowMeta)
           
 void setThreadNameFromToCopy(String from, int from_copy, String to, int to_copy)
          This method is used only in Trans.java when created RowSet at line 333.
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.pentaho.di.core.RowSet
getDestinationStepCopy, getDestinationStepName, getName, getOriginStepCopy, getOriginStepName, getRemoteSlaveServerName, getRowMeta, isBlocking, isDone, setDone, setRemoteSlaveServerName, setRowMeta, setThreadNameFromToCopy
 

Constructor Detail

BlockingRowSet

public BlockingRowSet(int maxSize)
Create new non-blocking-queue with maxSize capacity.

Parameters:
maxSize -
Method Detail

putRow

public boolean putRow(RowMetaInterface rowMeta,
                      Object[] rowData)
Description copied from interface: RowSet
Offer a row of data to this rowset providing for the description (metadata) of the row. If the buffer is full, wait (block) for a small period of time.

Specified by:
putRow in interface RowSet
Parameters:
rowMeta - The description of the row data
rowData - the row of data
Returns:
true if the row was successfully added to the rowset and false if this buffer was full.

putRowWait

public boolean putRowWait(RowMetaInterface rowMeta,
                          Object[] rowData,
                          long time,
                          TimeUnit tu)
Description copied from interface: RowSet
Offer a row of data to this rowset providing for the description (metadata) of the row. If the buffer is full, wait (block) for a period of time defined in this call.

Specified by:
putRowWait in interface RowSet
Parameters:
rowMeta - The description of the row data
rowData - the row of data
time - The number of units of time
tu - The unit of time to use
Returns:
true if the row was successfully added to the rowset and false if this buffer was full.

getRow

public Object[] getRow()
Description copied from interface: RowSet
Get a row from the input buffer, it blocks for a short period until a new row becomes available. Otherwise, it returns null.

Specified by:
getRow in interface RowSet
Returns:
a row of data or null if no row is available.

getRowImmediate

public Object[] getRowImmediate()
Description copied from interface: RowSet
Get the first row in the list immediately.

Specified by:
getRowImmediate in interface RowSet
Returns:
a row of data or null if no row is available.

getRowWait

public Object[] getRowWait(long timeout,
                           TimeUnit tu)
Description copied from interface: RowSet
get the first row in the list immediately if it is available or wait until timeout

Specified by:
getRowWait in interface RowSet
Returns:
a row of data or null if no row is available.

size

public int size()
Specified by:
size in interface RowSet
Returns:
Return the size (or max capacity) of the RowSet

compareTo

public int compareTo(RowSet rowSet)
Compares using the target steps and copy, not the source. That way, re-partitioning is always done in the same way.

Specified by:
compareTo in interface Comparable<RowSet>

equals

public boolean equals(org.pentaho.di.core.BaseRowSet rowSet)

setDone

public void setDone()
Specified by:
setDone in interface RowSet

isDone

public boolean isDone()
Specified by:
isDone in interface RowSet
Returns:
Returns true if there is no more input and vice versa

getOriginStepName

public String getOriginStepName()
Specified by:
getOriginStepName in interface RowSet
Returns:
Returns the originStepName.

getOriginStepCopy

public int getOriginStepCopy()
Specified by:
getOriginStepCopy in interface RowSet
Returns:
Returns the originStepCopy.

getDestinationStepName

public String getDestinationStepName()
Specified by:
getDestinationStepName in interface RowSet
Returns:
Returns the destinationStepName.

getDestinationStepCopy

public int getDestinationStepCopy()
Specified by:
getDestinationStepCopy in interface RowSet
Returns:
Returns the destinationStepCopy.

getName

public String getName()
Specified by:
getName in interface RowSet

setThreadNameFromToCopy

public void setThreadNameFromToCopy(String from,
                                    int from_copy,
                                    String to,
                                    int to_copy)
Description copied from interface: RowSet
This method is used only in Trans.java when created RowSet at line 333. Don't need any synchronization on this method

Specified by:
setThreadNameFromToCopy in interface RowSet

toString

public String toString()
Overrides:
toString in class Object

getRowMeta

public RowMetaInterface getRowMeta()
Specified by:
getRowMeta in interface RowSet
Returns:
the rowMeta

setRowMeta

public void setRowMeta(RowMetaInterface rowMeta)
Specified by:
setRowMeta in interface RowSet
Parameters:
rowMeta - the rowMeta to set

getRemoteSlaveServerName

public String getRemoteSlaveServerName()
Specified by:
getRemoteSlaveServerName in interface RowSet
Returns:
the targetSlaveServer

setRemoteSlaveServerName

public void setRemoteSlaveServerName(String remoteSlaveServerName)
Specified by:
setRemoteSlaveServerName in interface RowSet
Parameters:
remoteSlaveServerName - the remote slave server to set

isBlocking

public boolean isBlocking()
By default we don't report blocking, only for monitored transformations.

Specified by:
isBlocking in interface RowSet
Returns:
true if this row set is blocking on reading or writing.