ThreadResources resources = (ThreadResources)threadResources.get();
if (resources == null) {
resources = new ThreadResources();
resources.termEnum = terms();
// Cache does not have to be thread-safe, it is only used by one thread at the same time
resources.termInfoCache = new SimpleLRUCache(DEFAULT_CACHE_SIZE);
threadResources.set(resources);
}
return resources;
}