public class AsyncWriter extends ProxyWriter
DataEndpoint.StatelastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
AsyncWriter(DataWriter nestedDataWriter)
Creates an
AsyncWriter object, with the given DataWriter
and default capacity of 500 records that can be queued. |
AsyncWriter(DataWriter nestedDataWriter,
int maxQueuedRecords)
Creates an
AsyncWriter object, with the given DataWriter
and maximum number of records that can be queued. |
| 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 written 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). |
long |
getBufferSizeInBytes() |
DataException |
getException() |
long |
getPeakBufferSizeInBytes() |
int |
getPriority() |
void |
open()
Makes this endpoint ready for reading or writing.
|
void |
rethrowAsyncException()
Rethrows the exception thrown by the internal thread or returns silently if no exception was thrown.
|
AsyncWriter |
setPriority(int priority) |
void |
write(Record record)
Writes the specified record to this
DataWriter and increases the record-count by 1. |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter. |
getNestedWriter, interceptRecord, map, map, setNestedDataWriter, setNestedDataWritergetNestedEndpoint, getRootEndpoint, getRootWriter, getWriterdecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptiongetId, getName, resetIDpublic AsyncWriter(DataWriter nestedDataWriter, int maxQueuedRecords)
AsyncWriter object, with the given DataWriter
and maximum number of records that can be queued.public AsyncWriter(DataWriter nestedDataWriter)
AsyncWriter object, with the given DataWriter
and default capacity of 500 records that can be queued.public long getBufferSizeInBytes()
public long getPeakBufferSizeInBytes()
public int getPriority()
public AsyncWriter setPriority(int priority)
public DataException getException()
public void open()
throws DataException
DataEndpointopen in class ProxyWriterDataExceptionpublic void close()
throws DataException
DataEndpointclose in class ProxyWriterDataExceptionpublic int available()
throws DataException
DataWriteravailable in class ProxyWriterDataExceptionpublic void write(Record record) throws DataException
DataWriterDataWriter and increases the record-count by 1.
Any exception raised while writing will be converted to a DataException using DataObject.exception(Throwable).
Subclasses generally do not need to override this method, instead they should implement DataWriter.writeImpl(Record).
write in class DataWriterDataExceptionprotected void writeImpl(Record record) throws Throwable
DataWriterDataWriter.writeImpl in class ProxyWriterThrowablepublic void rethrowAsyncException()
public final DataException exception(String message, Throwable exception)
DataObjectDataException, 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 DataObjectpublic final DataException exception(Throwable exception)
DataObjectDataException 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 DataObjectpublic final DataException exception(String message)
DataObjectThe returned exception can then be thrown in the normal way.
exception in class DataObjectpublic final DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class ProxyWriterprotected DataException addExceptionPropertiesImpl(DataException exception)
Copyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.