Processor implementation to perform row processing tasks in parallel. The ConcurrentRowProcessor
wraps another Processor, and collects rows read from the input.
The actual row processing is performed in by wrapped Processor in a separate threadNote
by default the Context object passed on to the wrapped Processor will not reflect the
state of the parser at the time the row as generated, but the current state of the parser instead. You can enable the
contextCopyingEnabled flag to generate copies of the Context at the time each row was generated.
AbstractParser, Processor
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private T | |
| private boolean | |
| private final ExecutorService | |
| private volatile long | |
| private AbstractConcurrentProcessor. | |
| private final int | |
| private final Object | |
| private volatile long | |
| private volatile AbstractConcurrentProcessor. | |
| private Future | |
| private final Processor | |
| private volatile long |
| Access | Constructor and Description |
|---|---|
| public | AbstractConcurrentProcessor(Processor<T>
a regular processor)Processor implementation which will be executed in a separate thread.Creates a non-blocking |
| public | AbstractConcurrentProcessor(Processor<T>
a regular processor, int Processor implementation which will be executed in a separate thread.the limit of rows to be kept in memory before blocking the input parsing process. limit)Creates a blocking |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract T | |
| protected final long | |
| private T | |
| public boolean | Returns: a flag indicating whether the parsing context must be persisted along with the parsed row so its methods reflect the state of the parser at the time the record was produced.Indicates whether this processor should persist the |
| public final void | processEnded(T
A contextual object with information and controls over the state of the parsing process context)Implements com. |
| public final void | processStarted(T
A contextual object with information and controls over the current state of the parsing process context)Implements com. |
| public final void | rowProcessed(String[]
the data extracted by the parser for an individual record. Note that:
row, T
A contextual object with information and controls over the current state of the parsing process context)Implements com. |
| public void | setContextCopyingEnabled(boolean
a flag indicating whether the parsing context must be persisted along with the parsed row
so its methods reflect the state of the parser at the time the record was produced. contextCopyingEnabled)Configures this processor to persist the |
| private void | |
| protected abstract T |
| contextCopyingEnabled | back to summary |
|---|---|
| private boolean contextCopyingEnabled | |
| currentContext | back to summary |
|---|---|
| private T currentContext | |
| ended | back to summary |
|---|---|
| private boolean ended | |
| executor | back to summary |
|---|---|
| private final ExecutorService executor | |
| input | back to summary |
|---|---|
| private volatile long input | |
| inputQueue | back to summary |
|---|---|
| private AbstractConcurrentProcessor. | |
| limit | back to summary |
|---|---|
| private final int limit | |
| lock | back to summary |
|---|---|
| private final Object lock | |
| output | back to summary |
|---|---|
| private volatile long output | |
| outputQueue | back to summary |
|---|---|
| private volatile AbstractConcurrentProcessor. | |
| process | back to summary |
|---|---|
| private Future<Void> process | |
| processor | back to summary |
|---|---|
| private final Processor<T extends Context> processor | |
| rowCount | back to summary |
|---|---|
| private volatile long rowCount | |
| AbstractConcurrentProcessor | back to summary |
|---|---|
| public AbstractConcurrentProcessor(Processor<T> processor) Creates a non-blocking | |
| AbstractConcurrentProcessor | back to summary |
|---|---|
| public AbstractConcurrentProcessor(Processor<T> processor, int limit) Creates a blocking | |
| copyContext | back to summary |
|---|---|
| protected abstract T copyContext(T context) | |
| getRowCount | back to summary |
|---|---|
| protected final long getRowCount() | |
| grabContext | back to summary |
|---|---|
| private T grabContext(T context) | |
| isContextCopyingEnabled | back to summary |
|---|---|
| public boolean isContextCopyingEnabled() Indicates whether this processor should persist the
| |
| processEnded | back to summary |
|---|---|
| public final void processEnded(T context) Implements com. Doc from com. This method will by invoked by the parser once, after the parsing process stopped and all resources were closed. It will always be called by the parser: in case of errors, if the end of the input us reached, or if the user stopped the process manually using
| |
| processStarted | back to summary |
|---|---|
| public final void processStarted(T context) Implements com. Doc from com. This method will by invoked by the parser once, when it is ready to start processing the input.
| |
| rowProcessed | back to summary |
|---|---|
| public final void rowProcessed(String[] row, T context) Implements com. Doc from com. Invoked by the parser after all values of a valid record have been processed.
| |
| setContextCopyingEnabled | back to summary |
|---|---|
| public void setContextCopyingEnabled(boolean contextCopyingEnabled) Configures this processor to persist the
| |
| startProcess | back to summary |
|---|---|
| private void startProcess() | |
| wrapContext | back to summary |
|---|---|
| protected abstract T wrapContext(T context) | |
| Modifier and Type | Field and Description |
|---|---|
| public final T | |
| public AbstractConcurrentProcessor. | |
| public final String[] |
| context | back to summary |
|---|---|
| public final T context | |
| next | back to summary |
|---|---|
| public AbstractConcurrentProcessor. | |
| row | back to summary |
|---|---|
| public final String[] row | |
| Node | back to summary |
|---|---|
| public Node(String[] row, T context) | |