Package org.nuiton.i18n.plugin.parser
Class ParserExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.nuiton.i18n.plugin.parser.ParserExecutor
-
- All Implemented Interfaces:
Executor
,ExecutorService
,I18nParserConfiguration
public class ParserExecutor extends ThreadPoolExecutor implements I18nParserConfiguration
- Since:
- 1.2.2
- Author:
- poussin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nParserConfiguration
configuration
the incoming configuration (from mojo which contains shared result and logger)protected int
nbFiles
number of files registred to consumeprotected List<File>
touchedFiles
list of files touched (says having at least one i18n key)protected List<File>
treatedFiles
list of files consumed
-
Constructor Summary
Constructors Constructor Description ParserExecutor(I18nParserConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFile(FileParser parser, File... files)
Add a file to be consumed.protected void
afterExecute(Runnable r, Throwable t)
void
clear()
clean internal state after usage of the thread.protected I18nParserConfiguration
getConfiguration()
org.apache.maven.plugin.logging.Log
getLog()
protected int
getNbFilesToTreate()
org.nuiton.io.SortedProperties
getResult()
List<File>
getTouchedFiles()
List<File>
getTreatedFiles()
boolean
isShowTouchedFiles()
boolean
isSilent()
boolean
isVerbose()
void
terminatesAndWaits()
Ask the thread to stop.-
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, shutdownNow, terminated, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Field Detail
-
configuration
protected final I18nParserConfiguration configuration
the incoming configuration (from mojo which contains shared result and logger)
-
touchedFiles
protected final List<File> touchedFiles
list of files touched (says having at least one i18n key)
-
nbFiles
protected int nbFiles
number of files registred to consume
-
-
Constructor Detail
-
ParserExecutor
public ParserExecutor(I18nParserConfiguration configuration)
-
-
Method Detail
-
afterExecute
protected void afterExecute(Runnable r, Throwable t)
- Overrides:
afterExecute
in classThreadPoolExecutor
-
isVerbose
public boolean isVerbose()
- Specified by:
isVerbose
in interfaceI18nParserConfiguration
-
isSilent
public boolean isSilent()
- Specified by:
isSilent
in interfaceI18nParserConfiguration
-
isShowTouchedFiles
public boolean isShowTouchedFiles()
- Specified by:
isShowTouchedFiles
in interfaceI18nParserConfiguration
-
getLog
public org.apache.maven.plugin.logging.Log getLog()
- Specified by:
getLog
in interfaceI18nParserConfiguration
-
getResult
public org.nuiton.io.SortedProperties getResult()
- Specified by:
getResult
in interfaceI18nParserConfiguration
-
clear
public void clear()
clean internal state after usage of the thread.
-
addFile
public void addFile(FileParser parser, File... files)
Add a file to be consumed.- Parameters:
parser
- the parser of the filefiles
- files to parse
-
terminatesAndWaits
public void terminatesAndWaits() throws InterruptedException
Ask the thread to stop. It will finish all incoming files (but will not accept more files to parse) Note: The method does not return until all files are not consumed.- Throws:
InterruptedException
- if something wrong while waiting end of executor
-
getConfiguration
protected I18nParserConfiguration getConfiguration()
-
getNbFilesToTreate
protected int getNbFilesToTreate()
-
-