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:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService,I18nParserConfiguration
public class ParserExecutor extends java.util.concurrent.ThreadPoolExecutor implements I18nParserConfiguration
- Since:
- 1.2.2
- Author:
- poussin
-
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 -
Field Summary
Fields Modifier and Type Field Description protected I18nParserConfigurationconfigurationthe incoming configuration (from mojo which contains shared result and logger)protected intnbFilesnumber of files registred to consumeprotected java.util.List<java.io.File>touchedFileslist of files touched (says having at least one i18n key)protected java.util.List<java.io.File>treatedFileslist of files consumed -
Constructor Summary
Constructors Constructor Description ParserExecutor(I18nParserConfiguration configuration) -
Method Summary
Modifier and Type Method Description voidaddFile(FileParser parser, java.io.File... files)Add a file to be consumed.protected voidafterExecute(java.lang.Runnable r, java.lang.Throwable t)voidclear()clean internal state after usage of the thread.protected I18nParserConfigurationgetConfiguration()org.apache.maven.plugin.logging.LoggetLog()protected intgetNbFilesToTreate()org.nuiton.io.SortedPropertiesgetResult()java.util.List<java.io.File>getTouchedFiles()java.util.List<java.io.File>getTreatedFiles()booleanisShowTouchedFiles()booleanisSilent()booleanisVerbose()voidterminatesAndWaits()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
-
Field Details
-
configuration
the incoming configuration (from mojo which contains shared result and logger) -
treatedFiles
protected final java.util.List<java.io.File> treatedFileslist of files consumed -
touchedFiles
protected final java.util.List<java.io.File> touchedFileslist of files touched (says having at least one i18n key) -
nbFiles
protected int nbFilesnumber of files registred to consume
-
-
Constructor Details
-
Method Details
-
afterExecute
protected void afterExecute(java.lang.Runnable r, java.lang.Throwable t)- Overrides:
afterExecutein classjava.util.concurrent.ThreadPoolExecutor
-
isVerbose
public boolean isVerbose()- Specified by:
isVerbosein interfaceI18nParserConfiguration
-
isSilent
public boolean isSilent()- Specified by:
isSilentin interfaceI18nParserConfiguration
-
isShowTouchedFiles
public boolean isShowTouchedFiles()- Specified by:
isShowTouchedFilesin interfaceI18nParserConfiguration
-
getLog
public org.apache.maven.plugin.logging.Log getLog()- Specified by:
getLogin interfaceI18nParserConfiguration
-
getResult
public org.nuiton.io.SortedProperties getResult()- Specified by:
getResultin interfaceI18nParserConfiguration
-
getTreatedFiles
public java.util.List<java.io.File> getTreatedFiles() -
getTouchedFiles
public java.util.List<java.io.File> getTouchedFiles() -
clear
public void clear()clean internal state after usage of the thread. -
addFile
Add a file to be consumed.- Parameters:
parser- the parser of the filefiles- files to parse
-
terminatesAndWaits
public void terminatesAndWaits() throws java.lang.InterruptedExceptionAsk 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:
java.lang.InterruptedException- if something wrong while waiting end of executor
-
getConfiguration
-
getNbFilesToTreate
protected int getNbFilesToTreate()
-