Package com.opencsv.bean.concurrent
Class LineExecutor<T>
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.opencsv.bean.concurrent.IntolerantThreadPoolExecutor<T>
com.opencsv.bean.concurrent.LineExecutor<T>
- Type Parameters:
T- The type of the bean being converted to
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService,Spliterator<T>
A specific derivative of
IntolerantThreadPoolExecutor intended for
submitting lines of input to be converted to beans.- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicyNested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsFields inherited from class com.opencsv.bean.concurrent.IntolerantThreadPoolExecutor
accumulateThread, errorLocale, expectedRecords, resultQueue, thrownExceptionsQueueFields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsConstructorDescriptionLineExecutor(boolean orderedResults, Locale errorLocale, CompleteFileReader<T> completeFileReader) The only constructor available for this class. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks whether exceptions are available that should halt processing.voidprepare()Prepares this Executor to receive jobs.voidsubmitLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, List<BeanVerifier<T>> verifiers, String[] line, CsvExceptionHandler exceptionHandler) Submit one record for conversion to a bean.Methods inherited from class com.opencsv.bean.concurrent.IntolerantThreadPoolExecutor
afterExecute, characteristics, complete, estimateSize, getCapturedExceptions, getTerminalException, shutdownNow, tryAdvance, trySplitMethods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, terminated, toStringMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
closeMethods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
completeFileReader
-
-
Constructor Details
-
LineExecutor
public LineExecutor(boolean orderedResults, Locale errorLocale, CompleteFileReader<T> completeFileReader) The only constructor available for this class.- Parameters:
orderedResults- Whether order should be preserved in the resultserrorLocale- The locale to use for error messagescompleteFileReader- The thread that reads lines of input and feeds the results to this Executor
-
-
Method Details
-
prepare
public void prepare()Description copied from class:IntolerantThreadPoolExecutorPrepares this Executor to receive jobs.- Overrides:
preparein classIntolerantThreadPoolExecutor<T>
-
checkExceptions
protected void checkExceptions()Description copied from class:IntolerantThreadPoolExecutorChecks whether exceptions are available that should halt processing. This is the case with unrecoverable errors, such as parsing the input, or if exceptions in conversion should be thrown by request of the user.- Overrides:
checkExceptionsin classIntolerantThreadPoolExecutor<T>
-
submitLine
public void submitLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, List<BeanVerifier<T>> verifiers, String[] line, CsvExceptionHandler exceptionHandler) Submit one record for conversion to a bean.- Parameters:
lineNumber- Which record in the input file is being processedmapper- The mapping strategy to be usedfilter- A filter to remove beans from the running, if necessary. May be null.verifiers- The list of verifiers to run on beans after creationline- The line of input to be transformed into a beanexceptionHandler- The handler for exceptions thrown during record processing
-