Class TimedReader
Reads an underlying DataReader for a maximum period of time or until the source DataReader is finished.
-
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.DataReader
fieldLineage, recordLineageFields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this endpoint's current state to aDataException.voidclose()Indicates that this endpoint has finished reading or writing.longReturns the maximum reading time in milliseconds, measured fromopen().booleanReturnstrueif reading stopped due to the time expiring.voidopen()Makes this endpoint ready for reading or writing.read()Reads the next record from thisDataReaderand increases the record-count by 1.toString()Methods inherited from class com.northconcepts.datapipeline.core.ProxyReader
available, getNestedReader, interceptRecord, map, map, readImpl, setNestedDataReader, setNestedDataReaderMethods inherited from class com.northconcepts.datapipeline.core.DataReader
addLineage, getBufferSize, getNestedEndpoint, getReader, getRootEndpoint, getRootReader, isExhausted, isLineageSupported, isSaveLineage, peek, pop, push, setSaveLineage, skipMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCountMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
-
Constructor Details
-
TimedReader
-
-
Method Details
-
getMaxTime
public long getMaxTime()Returns the maximum reading time in milliseconds, measured fromopen(). -
open
Description copied from class:DataEndpointMakes this endpoint ready for reading or writing.- Overrides:
openin classProxyReader- Throws:
DataException
-
close
Description copied from class:DataEndpointIndicates that this endpoint has finished reading or writing.- Overrides:
closein classProxyReader- Throws:
DataException
-
read
Description copied from class:DataReaderReads the next record from thisDataReaderand increases the record-count by 1. This method will first read any pushed (DataReader.push(Record)) records before reading from the underlying source.If no record is available,
nullwill be returned. This method blocks until a record is available, the end of the stream is reached, or an exception is thrown.Any exception raised while reading will be converted to a
DataExceptionusingDataObject.exception(Throwable).Subclasses generally do not need to override this method, instead they should implement
DataReader.readImpl().- Overrides:
readin classDataReader- See Also:
-
addExceptionProperties
Description copied from class:EndpointAdds this endpoint's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Overrides:
addExceptionPropertiesin classProxyReader
-
toString
- Overrides:
toStringin classDataEndpoint
-
isTimeExpired
public boolean isTimeExpired()Returnstrueif reading stopped due to the time expiring.
-