Class 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 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

        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>>
    • 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 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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Spliterator

        forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
    • 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 results
        errorLocale - The locale to use for error messages
        completeFileReader - The thread that reads lines of input and feeds the results to this Executor
    • Method Detail

      • 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 class IntolerantThreadPoolExecutor<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 processed
        mapper - The mapping strategy to be used
        filter - A filter to remove beans from the running, if necessary. May be null.
        verifiers - The list of verifiers to run on beans after creation
        line - The line of input to be transformed into a bean
        exceptionHandler - The handler for exceptions thrown during record processing