コード例 #1
0
            public virtual System.Object Get(IndexReader reader, Entry key)
            {
                System.Collections.IDictionary innerCache;
                System.Object value_Renamed;
                System.Object readerKey = reader.GetFieldCacheKey();
                lock (readerCache.SyncRoot)
                {
                    innerCache = (System.Collections.IDictionary)readerCache[readerKey];
                    if (innerCache == null)
                    {
                        innerCache             = new System.Collections.Hashtable();
                        readerCache[readerKey] = innerCache;
                        value_Renamed          = null;
                    }
                    else
                    {
                        value_Renamed = innerCache[key];
                    }
                    if (value_Renamed == null)
                    {
                        value_Renamed   = new CreationPlaceholder();
                        innerCache[key] = value_Renamed;
                    }
                }
                if (value_Renamed is CreationPlaceholder)
                {
                    lock (value_Renamed)
                    {
                        CreationPlaceholder progress = (CreationPlaceholder)value_Renamed;
                        if (progress.value_Renamed == null)
                        {
                            progress.value_Renamed = CreateValue(reader, key);
                            lock (readerCache.SyncRoot)
                            {
                                innerCache[key] = progress.value_Renamed;
                            }

                            // Only check if key.custom (the parser) is
                            // non-null; else, we check twice for a single
                            // call to FieldCache.getXXX
                            if (key.custom != null && wrapper != null)
                            {
                                System.IO.StreamWriter infoStream = wrapper.GetInfoStream();
                                if (infoStream != null)
                                {
                                    PrintNewInsanity(infoStream, progress.value_Renamed);
                                }
                            }
                        }
                        return(progress.value_Renamed);
                    }
                }
                return(value_Renamed);
            }
コード例 #2
0
ファイル: FieldCacheImpl.cs プロジェクト: carrie901/mono
			public virtual System.Object Get(IndexReader reader, Entry key)
			{
				System.Collections.IDictionary innerCache;
				System.Object value_Renamed;
				System.Object readerKey = reader.GetFieldCacheKey();
				lock (readerCache.SyncRoot)
				{
					innerCache = (System.Collections.IDictionary) readerCache[readerKey];
					if (innerCache == null)
					{
						innerCache = new System.Collections.Hashtable();
						readerCache[readerKey] = innerCache;
						value_Renamed = null;
					}
					else
					{
						value_Renamed = innerCache[key];
					}
					if (value_Renamed == null)
					{
						value_Renamed = new CreationPlaceholder();
						innerCache[key] = value_Renamed;
					}
				}
				if (value_Renamed is CreationPlaceholder)
				{
					lock (value_Renamed)
					{
						CreationPlaceholder progress = (CreationPlaceholder) value_Renamed;
						if (progress.value_Renamed == null)
						{
							progress.value_Renamed = CreateValue(reader, key);
							lock (readerCache.SyncRoot)
							{
								innerCache[key] = progress.value_Renamed;
							}
							
							// Only check if key.custom (the parser) is
							// non-null; else, we check twice for a single
							// call to FieldCache.getXXX
							if (key.custom != null && wrapper != null)
							{
								System.IO.StreamWriter infoStream = wrapper.GetInfoStream();
								if (infoStream != null)
								{
									PrintNewInsanity(infoStream, progress.value_Renamed);
								}
							}
						}
						return progress.value_Renamed;
					}
				}
				return value_Renamed;
			}