Class PipelinePool


  • class PipelinePool
    extends java.lang.Object
    Caches pre-configured JLanguageTool instances to avoid costly setup time of rules, etc. TODO: reimplement using apache commons KeyedObjectPool
    • Field Detail

      • logger

        private static final org.slf4j.Logger logger
      • cache

        private final org.languagetool.ResultCache cache
      • internalServer

        private final boolean internalServer
      • pipelineExpireCheckTimestamp

        private long pipelineExpireCheckTimestamp
      • pipelinesUsed

        private long pipelinesUsed
      • requests

        private long requests
    • Constructor Detail

      • PipelinePool

        PipelinePool​(HTTPServerConfig config,
                     org.languagetool.ResultCache cache,
                     boolean internalServer)
    • Method Detail

      • returnPipeline

        void returnPipeline​(PipelinePool.PipelineSettings settings,
                            Pipeline pipeline)
                     throws java.util.concurrent.ExecutionException
        Throws:
        java.util.concurrent.ExecutionException
      • createPipeline

        Pipeline createPipeline​(org.languagetool.Language lang,
                                org.languagetool.Language motherTongue,
                                TextChecker.QueryParams params,
                                org.languagetool.GlobalConfig globalConfig,
                                org.languagetool.UserConfig userConfig,
                                java.util.List<java.lang.String> disabledRuleIds)
                         throws java.lang.Exception
        Create a JLanguageTool instance for a specific language, mother tongue, and rule configuration. Uses Pipeline wrapper to safely share objects
        Parameters:
        lang - the language to be used
        motherTongue - the user's mother tongue or null
        Throws:
        java.lang.Exception
      • configureFromRulesFile

        private void configureFromRulesFile​(org.languagetool.JLanguageTool langTool,
                                            org.languagetool.Language lang)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • configureFromGUI

        private void configureFromGUI​(org.languagetool.JLanguageTool langTool,
                                      org.languagetool.Language lang)
                               throws java.io.IOException
        Throws:
        java.io.IOException