com.northconcepts.datapipeline.throttle
Class ThrottledWriter

java.lang.Object
  extended by com.northconcepts.datapipeline.core.DataEndpoint
      extended by com.northconcepts.datapipeline.core.DataWriter
          extended by com.northconcepts.datapipeline.core.ProxyWriter
              extended by com.northconcepts.datapipeline.meter.MeteredWriter
                  extended by com.northconcepts.datapipeline.throttle.ThrottledWriter
All Implemented Interfaces:
Metered, Throttled

public class ThrottledWriter
extends MeteredWriter
implements Throttled

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


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
ThrottledWriter(DataWriter writer, int bytesPerSecond)
           
 
Method Summary
 DataException addExceptionProperties(DataException exception)
          Adds this endpoint's current state to a DataException.
 Throttle getThrottle()
           
protected  Record interceptRecord(Record record)
           
 
Methods inherited from class com.northconcepts.datapipeline.meter.MeteredWriter
close, getMeter
 
Methods inherited from class com.northconcepts.datapipeline.core.ProxyWriter
getNestedWriter, open, setNestedDataWriter, setNestedDataWriter, writeImpl
 
Methods inherited from class com.northconcepts.datapipeline.core.DataWriter
getRootWriter, write
 
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

ThrottledWriter

public ThrottledWriter(DataWriter writer,
                       int bytesPerSecond)
Method Detail

getThrottle

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

interceptRecord

protected Record interceptRecord(Record record)
                          throws Throwable
Overrides:
interceptRecord in class MeteredWriter
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 MeteredWriter


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