Example #1
0
        public virtual void PutRuntimeFacetData(string name, object data)
        {
            var map = _runtimeFacetDataMap.Get();

            if (map == null)
            {
                map = new Dictionary <string, object>();
                _runtimeFacetDataMap.Set(map);
            }
            map.Put(name, data);
        }
Example #2
0
        public virtual void PutRuntimeFacetHandler(string name, IRuntimeFacetHandler data)
        {
            var map = _runtimeFacetHandlerMap.Get();

            if (map == null)
            {
                map = new Dictionary <string, IRuntimeFacetHandler>();
                _runtimeFacetHandlerMap.Set(map);
            }
            map.Put(name, data);
        }
Example #3
0
        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);
        }
Example #4
0
        /// <summary>
        ///     Sets the <see cref="TokenStream"/> used by Analyzers that implement (overrides)
        ///     <see cref="Analyzer.ReusableTokenStream(String, TextReader)"/>
        ///     to save a <see cref="TokenStream" /> for later re-use by the same thread.
        /// </summary>
        /// <param name="obj">The previous <see cref="TokenStream"/>.</param>
        protected internal virtual void  SetPreviousTokenStream(System.Object obj)
        {
            try
            {
                tokenStreams.Set(obj);
            }
            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;
            }
        }