com.northconcepts.datapipeline.throttle
Class ThrottledReader

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataReader
          extended by com.northconcepts.datapipeline.core.ProxyReader
              extended by com.northconcepts.datapipeline.meter.MeteredReader
                  extended by com.northconcepts.datapipeline.throttle.ThrottledReader
All Implemented Interfaces:
Metered, Throttled

public class ThrottledReader
extends MeteredReader
implements Throttled

A proxy that limits the rate (bytes/second) at which data is read.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State
 
Field Summary
 
Fields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
BUFFER_SIZE, log
 
Constructor Summary
ThrottledReader(DataReader reader, int bytesPerSecond)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 Throttle getThrottle()
           
protected  Record readImpl()
          Overridden by subclasses to read the next record from this DataReader.
 
Methods inherited from class com.northconcepts.datapipeline.meter.MeteredReader
close, getMeter
 
Methods inherited from class com.northconcepts.datapipeline.core.ProxyReader
available, getNestedReader, interceptRecord, open, setNestedDataReader, setNestedDataReader
 
Methods inherited from class com.northconcepts.datapipeline.core.DataReader
getBufferSize, getRootReader, peek, pop, push, read, skip
 
Methods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
assertNotOpened, assertOpened, decrementRecordCount, exception, exception, exception, finalize, getDescription, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, getState, incrementRecordCount, isClosed, isOpen, isRecordCountBigInteger, resetRecordCount, setDescription, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThrottledReader

public ThrottledReader(DataReader reader,
                       int bytesPerSecond)
Method Detail

getThrottle

public Throttle getThrottle()
Specified by:
getThrottle in interface Throttled

readImpl

protected Record readImpl()
                   throws Throwable
Description copied from class: DataReader
Overridden by subclasses to read the next record from this DataReader.

If no record is available, null will be returned.

Overrides:
readImpl in class MeteredReader
Throws:
Throwable

addExceptionProperties

public DataException addExceptionProperties(DataException exception)
Description copied from class: DataEndpoint
Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.

Overrides:
addExceptionProperties in class MeteredReader


Copyright (c) 2007-2010 North Concepts Inc. All Rights Reserved.