Description
The commons.opennlp model allows to load models by their names via the DataFileProvider infrastructure. Loaded models are cached in memory.
If two components do request the same model in a short time. Especially when the 2md request for a model comes before the first was completed the same model is loaded twice in parallel. This will result that two instances of the model are loaded.
While the 2nd request will override the cached model of the first the first component requesting the model might still hold a reference. In this case two instances of the model are holded in-memory.
To solve those situations the OpenNLP service needs to use lock while loading models.