Speed Up Loading of First Check

I’m using JLanguageTool in Java Spring. Currently I’m loading the language tool as follows, in the PostConstruct method:

langTool = new JLanguageTool(new AmericanEnglish());
langTool.disableRules(RULES_TO_EXCLUDE);

I would like everything to be loaded when I initialize this JLanguageTool object, however I notice that the first time I use langTools.check(text) the response takes a few seconds longer to come back than in the next attempts. I’m assuming this is because of some sort of lazy loading in JLanguageTool which means that not everything is loaded until I perform the first check.

Is there some way to override this setting and force object to be completely initialized when I create new JLanguageTool? This way all uses of langTools.check(text) will be using completely initialized object.

The easiest (and maybe only) workaround is to just send a check() call after creation of the object with a short static sentence.

Thanks @dnaber !
I tried this workaround and managed to do this, but am looking to understand why it happens so that I can avoid calling .check()

It’s as you said: Some data gets loaded only once it is needed, and that takes quite some time. Any other workaround would have the same effect as just calling check().

@dnaber thanks. In that case I guess I’ll just stick with my current solution and call check()