public class AsyncReader extends ProxyReader
DataEndpoint.State
Modifier and Type | Field and Description |
---|---|
protected Object |
lock |
static int |
MINIMUM_BUFFER_SIZE |
fieldLineage, recordLineage
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
AsyncReader(DataReader reader) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
protected DataException |
addExceptionPropertiesImpl(DataException exception) |
int |
available()
Returns the number of records that can probably be read without blocking.
|
void |
close()
Indicates that this endpoint has finished reading or writing.
|
DataException |
exception(String message)
Creates an exception with the specified message and containing this endpoint's properties (name-value pairs).
|
DataException |
exception(String message,
Throwable exception)
Converts an exception to a
DataException , prefixing the original message with the specified text
and adding this endpoint's properties (name-value pairs). |
DataException |
exception(Throwable exception)
Converts an exception to a
DataException and adds this endpoint's properties (name-value pairs). |
protected void |
fillCache() |
long |
getBufferSizeInBytes() |
DataException |
getException() |
long |
getMaxBufferSizeInBytes() |
long |
getPeakBufferSizeInBytes() |
int |
getPriority() |
void |
open()
Makes this endpoint ready for reading or writing.
|
protected Record |
pop()
Removes and returns the next record in this
DataReader s buffer or null if it is empty. |
void |
push(Record record)
Adds a record to this
DataReader s buffer. |
protected Record |
readImpl()
Overridden by subclasses to read the next record from this
DataReader . |
void |
rethrowAsyncException()
Rethrows the exception thrown by the internal thread or returns silently if no exception was thrown.
|
AsyncReader |
setMaxBufferSizeInBytes(long maxBufferSize) |
AsyncReader |
setPriority(int priority) |
getNestedReader, interceptRecord, map, map, setNestedDataReader, setNestedDataReader
addLineage, getBufferSize, getNestedEndpoint, getRootEndpoint, getRootReader, isExhausted, isLineageSupported, isSaveLineage, peek, read, setSaveLineage, skip
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
getId, getName, resetID
public static final int MINIMUM_BUFFER_SIZE
protected final Object lock
public AsyncReader(DataReader reader)
public long getMaxBufferSizeInBytes()
public AsyncReader setMaxBufferSizeInBytes(long maxBufferSize)
public long getBufferSizeInBytes()
public long getPeakBufferSizeInBytes()
public int getPriority()
public AsyncReader setPriority(int priority)
public DataException getException()
public void open() throws DataException
DataEndpoint
open
in class ProxyReader
DataException
public void close() throws DataException
DataEndpoint
close
in class ProxyReader
DataException
public void push(Record record)
DataReader
DataReader
s buffer. Records in the buffer will be returned
by DataReader.read()
before attempting to read from the underlying implementation.push
in class DataReader
DataReader.read()
protected Record pop()
DataReader
DataReader
s buffer or null
if it is empty.pop
in class DataReader
DataReader.push(Record)
public int available() throws DataException
DataReader
available
in class ProxyReader
DataException
protected void fillCache()
public void rethrowAsyncException()
protected Record readImpl() throws Throwable
DataReader
DataReader
. The default
implementation of DataReader.read()
now insures that this method will not be called again after it returns
a null
.
If no record is available, null
will be returned.
readImpl
in class ProxyReader
Throwable
public final DataException exception(String message, Throwable exception)
DataObject
DataException
, prefixing the original message with the specified text
and adding this endpoint's properties (name-value pairs).
The returned exception can then be thrown in the normal way.
If the supplied exception is an instanceof DataException
, it will be returned, otherwise it will be
nested inside a DataException
. In either case the result message will contain the new prefix along
with this endpoint properties.
exception
in class DataObject
public final DataException exception(Throwable exception)
DataObject
DataException
and adds this endpoint's properties (name-value pairs).
The returned exception can then be thrown in the normal way.
If the supplied exception is an instanceof DataException
, it will be returned, otherwise it will be
nested inside a DataException
. In either case the result message will contain this endpoint properties.
exception
in class DataObject
public final DataException exception(String message)
DataObject
The returned exception can then be thrown in the normal way.
exception
in class DataObject
public final DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class ProxyReader
protected DataException addExceptionPropertiesImpl(DataException exception)
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.