public virtual object GetRuntimeFacetData(string name) { var map = _runtimeFacetDataMap.Get(); if (map == null) { return(null); } return(map.Get(name)); }
public virtual IRuntimeFacetHandler GetRuntimeFacetHandler(string name) { var map = _runtimeFacetHandlerMap.Get(); if (map == null) { return(null); } return(map.Get(name)); }
private ThreadResources GetThreadResources() { ThreadResources resources = 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); }
/// <summary> /// Gets the previous <see cref="TokenStream"/> used by Analyzers that implement (overrides) /// <see cref="Analyzer.ReusableTokenStream(String, TextReader)"/> to retrieve a /// previously saved <see cref="TokenStream"/> for re-use by the same thread. /// </summary> /// <remarks> /// <para> /// This method uses a <see cref="CloseableThreadLocal{T}"/> to store the previous thread and retrieve it. /// </para> /// </remarks> /// <exception cref="AlreadyClosedException">Throws when there is a null reference exception and the analyzer is closed.</exception> /// <exception cref="System.NullReferenceException"> /// Throws when there is a null reference to <see cref="CloseableThreadLocal{T}"/> and the /// analyzer is still open. /// </exception> // REFACTOR: turn into a property. protected internal virtual System.Object GetPreviousTokenStream() { try { return(tokenStreams.Get()); } catch (System.NullReferenceException ex) { // GLOBALIZATION: get exception message from resource file. if (tokenStreams == null) { throw new AlreadyClosedException("this Analyzer is closed", ex); } // default to re-throw keep stack trace intact. throw; } }