com.univocity.parsers.common.processor
Class ConcurrentRowProcessor

java.lang.Object
  extended by com.univocity.parsers.common.processor.ConcurrentRowProcessor
All Implemented Interfaces:
RowProcessor

public class ConcurrentRowProcessor
extends Object
implements RowProcessor

A RowProcessor implementation to perform row processing tasks in parallel. The ConcurrentRowProcessor wraps another RowProcessor, and collects rows read from the input. The actual row processing is performed in by wrapped RowProcessor in a separate thread.

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
AbstractParser, RowProcessor

Constructor Summary
ConcurrentRowProcessor(RowProcessor rowProcessor)
          Creates a non-blocking ConcurrentRowProcessor, to perform processing of rows parsed from the input in a separate thread.
 
Method Summary
 void processEnded(ParsingContext context)
          This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.
 void processStarted(ParsingContext context)
          This method will by invoked by the parser once, when it is ready to start processing the input.
 void rowProcessed(String[] row, ParsingContext context)
          Invoked by the parser after all values of a valid record have been processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentRowProcessor

public ConcurrentRowProcessor(RowProcessor rowProcessor)
Creates a non-blocking ConcurrentRowProcessor, to perform processing of rows parsed from the input in a separate thread.

Parameters:
rowProcessor - a regular RowProcessor implementation which will be executed in a separate thread.
Method Detail

processStarted

public final void processStarted(ParsingContext context)
Description copied from interface: RowProcessor
This method will by invoked by the parser once, when it is ready to start processing the input.

Specified by:
processStarted in interface RowProcessor
Parameters:
context - A contextual object with information and controls over the current state of the parsing process

rowProcessed

public final void rowProcessed(String[] row,
                               ParsingContext context)
Description copied from interface: RowProcessor
Invoked by the parser after all values of a valid record have been processed.

Specified by:
rowProcessed in interface RowProcessor
Parameters:
row - the data extracted by the parser for an individual record. Note that:
context - A contextual object with information and controls over the current state of the parsing process

processEnded

public final void processEnded(ParsingContext context)
Description copied from interface: RowProcessor
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 ParsingContext.stop().

Specified by:
processEnded in interface RowProcessor
Parameters:
context - A contextual object with information and controls over the state of the parsing process


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.