public TokenizedInputDictionaryExtension newTokenizedInputExtension(DefaultTokenizedInput input) { synchronized (tokenizedInputExtensionPool) { if (!tokenizedInputExtensionPool.empty()) { TokenizedInputDictionaryExtension result = (TokenizedInputDictionaryExtension) tokenizedInputExtensionPool.pop(); result.setInput(input); return result; } } return new TokenizedInputDictionaryExtension(this, input); }
void freeTokenizedInputExtension(TokenizedInputDictionaryExtension e) { if (tokenizedInputExtensionPool.size() > 1000) { return; } // allow them to be collected e.tokenizedInput = null; tokenizedInputExtensionPool.push(e); }