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:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.Spliterator<T>
public class LineExecutor<T> extends IntolerantThreadPoolExecutor<T>
A specific derivative ofIntolerantThreadPoolExecutor
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
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
Nested classes/interfaces inherited from interface java.util.Spliterator
java.util.Spliterator.OfDouble, java.util.Spliterator.OfInt, java.util.Spliterator.OfLong, java.util.Spliterator.OfPrimitive<T extends java.lang.Object,T_CONS extends java.lang.Object,T_SPLITR extends java.util.Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Field Summary
Fields Modifier and Type Field Description private CompleteFileReader<T>
completeFileReader
-
Fields inherited from class com.opencsv.bean.concurrent.IntolerantThreadPoolExecutor
accumulateThread, errorLocale, expectedRecords, resultQueue, thrownExceptionsQueue
-
-
Constructor Summary
Constructors Constructor Description LineExecutor(boolean orderedResults, java.util.Locale errorLocale, CompleteFileReader<T> completeFileReader)
The only constructor available for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkExceptions()
Checks whether exceptions are available that should halt processing.void
prepare()
Prepares this Executor to receive jobs.void
submitLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, java.util.List<BeanVerifier<T>> verifiers, java.lang.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, trySplit
-
Methods 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, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Field Detail
-
completeFileReader
private final CompleteFileReader<T> completeFileReader
-
-
Constructor Detail
-
LineExecutor
public LineExecutor(boolean orderedResults, java.util.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 Detail
-
prepare
public void prepare()
Description copied from class:IntolerantThreadPoolExecutor
Prepares this Executor to receive jobs.- Overrides:
prepare
in classIntolerantThreadPoolExecutor<T>
-
checkExceptions
protected void checkExceptions()
Description copied from class:IntolerantThreadPoolExecutor
Checks 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:
checkExceptions
in classIntolerantThreadPoolExecutor<T>
-
submitLine
public void submitLine(long lineNumber, MappingStrategy<? extends T> mapper, CsvToBeanFilter filter, java.util.List<BeanVerifier<T>> verifiers, java.lang.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
-
-