当前位置: 首页>>代码示例>>C#>>正文


C# Impl.ExceptionAggregator类代码示例

本文整理汇总了C#中Raven.Database.Impl.ExceptionAggregator的典型用法代码示例。如果您正苦于以下问题:C# ExceptionAggregator类的具体用法?C# ExceptionAggregator怎么用?C# ExceptionAggregator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExceptionAggregator类属于Raven.Database.Impl命名空间,在下文中一共展示了ExceptionAggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Dispose

		public void Dispose()
		{
			disposerLock.EnterWriteLock();
			try
			{
				if (disposed)
					return;

				disposed = true;

				var exceptionAggregator = new ExceptionAggregator("Could not properly dispose TransactionalStorage");

				exceptionAggregator.Execute(() => current.Dispose());

				if (tableStorage != null)
					exceptionAggregator.Execute(() => tableStorage.Dispose());

				if (bufferPool != null)
					exceptionAggregator.Execute(() => bufferPool.Dispose());

				exceptionAggregator.ThrowIfNeeded();
			}
			finally
			{
				disposerLock.ExitWriteLock();
			}
		}
开发者ID:mdavis,项目名称:ravendb,代码行数:27,代码来源:TransactionalStorage.cs

示例2: Dispose

		public void Dispose()
		{
			var aggregator = new ExceptionAggregator("Error during ResourceTimerManager disposal.");

			foreach (var timer in timers)
			{
				var t = timer;
				aggregator.Execute(() =>
				{
					if (t != null)
						t.Dispose();
				});
			}

			aggregator.ThrowIfNeeded();
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:16,代码来源:ResourceTimerManager.cs

示例3: Close

		public void Close()
		{
			var exceptionAggregator = new ExceptionAggregator(log, "Failed to close response");
			exceptionAggregator.Execute(OutputStream.Flush);
			exceptionAggregator.Execute(OutputStream.Dispose);
			if (StreamsToDispose!= null)
			{
				foreach (var stream in StreamsToDispose)
				{
					exceptionAggregator.Execute(stream.Flush);
					exceptionAggregator.Execute(stream.Dispose);
				}
			}
			exceptionAggregator.Execute(response.Close);

			exceptionAggregator.ThrowIfNeeded();
		}
开发者ID:nberardi,项目名称:ravendb,代码行数:17,代码来源:HttpListenerResponseAdapter.cs

示例4: Dispose

        public void Dispose(ExceptionAggregator exceptionAggregator)
        {
            foreach (var pendingTaskAndState in pendingTasks.Select(shouldDispose => shouldDispose.Value))
            {
                exceptionAggregator.Execute(() =>
                {
                    try
                    {
#if DEBUG
                        pendingTaskAndState.Task.Wait(3000);
#else
						pendingTaskAndState.Task.Wait();
#endif
                    }
                    catch (Exception)
                    {
                        // we explictly don't care about this during shutdown
                    }
                });
            }

            pendingTasks.Clear();
        }
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:23,代码来源:TaskActions.cs

示例5: Dispose

        public void Dispose()
        {
            var exceptionAggregator = new ExceptionAggregator(Log, string.Format("Could not properly close index storage for file system '{0}'", name));

            exceptionAggregator.Execute(() => { if (analyzer != null) analyzer.Close(); });
            exceptionAggregator.Execute(() => { if (currentIndexSearcherHolder != null)  currentIndexSearcherHolder.SetIndexSearcher(null); });
            exceptionAggregator.Execute(() => SafeDispose(crashMarker) );
            exceptionAggregator.Execute(() => SafeDispose(writer) );
            exceptionAggregator.Execute(() => SafeDispose(directory) );

            exceptionAggregator.ThrowIfNeeded();
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:12,代码来源:IndexStorage.cs

示例6: Dispose

		public void Dispose()
		{
			disposerLock.EnterWriteLock();
			try
			{
				TenantDatabaseModified.Occured -= TenantDatabaseRemoved;
				var exceptionAggregator = new ExceptionAggregator(logger, "Could not properly dispose of HttpServer");
				exceptionAggregator.Execute(() =>
				{
					if (databasesCleanupTimer != null)
						databasesCleanupTimer.Dispose();
				});
				exceptionAggregator.Execute(() =>
				{
					if (listener != null && listener.IsListening)
						listener.Stop();
				});
				disposed = true;

				exceptionAggregator.Execute(() =>
				{
					lock (ResourcesStoresCache)
					{
						foreach (var documentDatabase in ResourcesStoresCache)
						{
							var database = documentDatabase.Value;
							exceptionAggregator.Execute(database.Dispose);
						}
						ResourcesStoresCache.Clear();
					}
				});

				exceptionAggregator.Execute(currentConfiguration.Dispose);
				exceptionAggregator.Execute(currentDatabase.Dispose);
				exceptionAggregator.Execute(currentTenantId.Dispose);

				exceptionAggregator.ThrowIfNeeded();
			}
			finally
			{
				disposerLock.ExitWriteLock();
			}
		}
开发者ID:csainty,项目名称:ravendb,代码行数:43,代码来源:HttpServer.cs

示例7: Dispose

		public void Dispose()
		{
			if (disposed)
				return;

			// give it 3 seconds to complete requests
			for (int i = 0; i < 30 && Interlocked.Read(ref metricsCounters.ConcurrentRequestsCount) > 0; i++)
			{
				Thread.Sleep(100);
			}

			AppDomain.CurrentDomain.ProcessExit -= ShouldDispose;
			AppDomain.CurrentDomain.DomainUnload -= ShouldDispose;

			disposed = true;

			var exceptionAggregator = new ExceptionAggregator(Log, "Could not properly dispose RavenFileSystem");

			if (synchronizationTask != null)
				exceptionAggregator.Execute(synchronizationTask.Dispose);

			if (storage != null)
				exceptionAggregator.Execute(storage.Dispose);

			if (search != null)
				exceptionAggregator.Execute(search.Dispose);

			if (sigGenerator != null)
				exceptionAggregator.Execute(sigGenerator.Dispose);

			if (BufferPool != null)
				exceptionAggregator.Execute(BufferPool.Dispose);

			if (metricsCounters != null)
				exceptionAggregator.Execute(metricsCounters.Dispose);

			if (Tasks != null)
				Tasks.Dispose(exceptionAggregator);

			exceptionAggregator.ThrowIfNeeded();
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:41,代码来源:RavenFileSystem.cs

示例8: Dispose

	    public void Dispose()
        {
            var tryEnterWriteLock = disposerLock.TryEnterWriteLock(TimeSpan.FromMinutes(2));
            try
            {
                if (tryEnterWriteLock == false)
                    log.Warn("After waiting for 2 minutes, could not acquire disposal lock, will force disposal anyway, pending transactions will all error");

                if (disposed)
                    return;

                var exceptionAggregator = new ExceptionAggregator(log, "Could not close database properly");
                disposed = true;
                exceptionAggregator.Execute(current.Dispose);
                if (documentCacher != null)
                    exceptionAggregator.Execute(documentCacher.Dispose);

                if (inFlightTransactionalState != null)
                    exceptionAggregator.Execute(inFlightTransactionalState.Dispose);

                exceptionAggregator.Execute(() =>
                    {
                        try
                        {
                            Api.JetTerm2(instance, TermGrbit.Complete);
                        }
                        catch (Exception e1)
                        {
                            log.ErrorException(
                                "Unexpected error occurred while terminating Esent Storage. Ignoring this error to allow to shutdown RavenDB instance.",
                                e1);

                            try
                            {
                                log.Warn(
                                    "Will now attempt to perform an abrupt shutdown, because asking nicely didn't work. You might need to run defrag on the database to recover potentially lost space (but no data will be lost).");
                                Api.JetTerm2(instance, TermGrbit.Abrupt);
                            }
                            catch (Exception e2)
                            {

                                log.FatalException(
                                    "Couldn't shut down the database server even when using abrupt, something is probably wrong and you'll need to restart the server process to access the database",
                                    e2);
                            }
                        }
                        finally
                        {
                            GC.SuppressFinalize(this);
                        }
                    });

                exceptionAggregator.ThrowIfNeeded();
            }
            catch (Exception e)
            {
                log.FatalException("Could not dispose of the transactional storage for " + path, e);
                throw;
            }
            finally
            {
                if (tryEnterWriteLock)
                    disposerLock.ExitWriteLock();
            }
        }
开发者ID:GorelH,项目名称:ravendb,代码行数:65,代码来源:TransactionalStorage.cs

示例9: Dispose

		public void Dispose()
		{
			disposerLock.EnterWriteLock();
			try
			{
				TenantDatabaseModified.Occured -= TenantDatabaseRemoved;
				var exceptionAggregator = new ExceptionAggregator(logger, "Could not properly dispose of HttpServer");
                exceptionAggregator.Execute(() =>
                {
                    foreach (var databaseTransportState in databaseTransportStates)
                    {
                        databaseTransportState.Value.Dispose();
                    }
                });
				exceptionAggregator.Execute(() =>
				{
					if (serverTimer != null)
						serverTimer.Dispose();
				});
				exceptionAggregator.Execute(() =>
				{
					if (listener != null && listener.IsListening)
						listener.Close();
				});
				disposed = true;

				if (requestAuthorizer != null)
					exceptionAggregator.Execute(requestAuthorizer.Dispose);

				exceptionAggregator.Execute(() =>
				{
					using (ResourcesStoresCache.WithAllLocks())
					{
						// shut down all databases in parallel, avoid having to wait for each one
						Parallel.ForEach(ResourcesStoresCache.Values, dbTask =>
						{
							if (dbTask.IsCompleted == false)
							{
								dbTask.ContinueWith(task =>
								{
									if (task.Status != TaskStatus.RanToCompletion)
										return;

									try
									{
										task.Result.Dispose();
									}
									catch (Exception e)
									{
										logger.WarnException("Failure in deferred disposal of a database", e);
									}
								});
							}
							else if (dbTask.Status == TaskStatus.RanToCompletion)
							{
								exceptionAggregator.Execute(dbTask.Result.Dispose);
							}
							// there is no else, the db is probably faulted
						});
						ResourcesStoresCache.Clear();
					}
				});

				exceptionAggregator.Execute(currentConfiguration.Dispose);
				exceptionAggregator.Execute(currentDatabase.Dispose);
				exceptionAggregator.Execute(currentTenantId.Dispose);
				exceptionAggregator.Execute(bufferPool.Dispose);
				exceptionAggregator.ThrowIfNeeded();
			}
			finally
			{
				disposerLock.ExitWriteLock();
			}
		}
开发者ID:urbanfly,项目名称:ravendb,代码行数:74,代码来源:HttpServer.cs

示例10: Dispose

		public void Dispose()
		{
			if (disposed)
				return;

			var onDisposing = Disposing;
			if(onDisposing!=null)
				onDisposing(this, EventArgs.Empty);

			var exceptionAggregator = new ExceptionAggregator(log, "Could not properly dispose of DatabaseDocument");

			exceptionAggregator.Execute(() =>
			{
				AppDomain.CurrentDomain.DomainUnload -= DomainUnloadOrProcessExit;
				AppDomain.CurrentDomain.ProcessExit -= DomainUnloadOrProcessExit;
				disposed = true;
				workContext.StopWork();
			});
			
			exceptionAggregator.Execute(() =>
			{
				foreach (var value in ExtensionsState.Values.OfType<IDisposable>())
				{
					exceptionAggregator.Execute(value.Dispose);
				}
			});
			
			exceptionAggregator.Execute(() =>
			{
				foreach (var shouldDispose in toDispose)
				{
					exceptionAggregator.Execute(shouldDispose.Dispose);
				}
			});

			exceptionAggregator.Execute(() =>
			{
				if (indexingBackgroundTask != null)
					indexingBackgroundTask.Wait();
			});
			exceptionAggregator.Execute(() =>
			{
				if (reducingBackgroundTask != null)
					reducingBackgroundTask.Wait();
			});

			exceptionAggregator.Execute(() =>
			{
				var disposable = backgroundTaskScheduler as IDisposable;
				if (disposable != null)
					disposable.Dispose();
			});

			if (TransactionalStorage != null)
				exceptionAggregator.Execute(TransactionalStorage.Dispose);
			if (IndexStorage != null)
				exceptionAggregator.Execute(IndexStorage.Dispose);

			if (Configuration != null)
				exceptionAggregator.Execute(Configuration.Dispose);

			exceptionAggregator.Execute(disableAllTriggers.Dispose);

			if (workContext != null)
				exceptionAggregator.Execute(workContext.Dispose);



			exceptionAggregator.ThrowIfNeeded();
		}
开发者ID:pierslawson,项目名称:ravendb,代码行数:70,代码来源:DocumentDatabase.cs

示例11: Dispose

		public void Dispose()
		{
			disposerLock.EnterWriteLock();
			try
			{
				if (disposed)
					return;

				var exceptionAggregator = new ExceptionAggregator(log, "Could not close database properly");
				disposed = true;
				exceptionAggregator.Execute(current.Dispose);
				if (documentCacher != null)
					exceptionAggregator.Execute(documentCacher.Dispose);
				exceptionAggregator.Execute(() =>
					{
						Api.JetTerm2(instance, TermGrbit.Complete);
						GC.SuppressFinalize(this);
					});

				exceptionAggregator.ThrowIfNeeded();
			}
			catch (Exception e)
			{
				log.FatalException("Could not dispose of the transactional storage for " + path, e);
				throw;
			}
			finally
			{
				disposerLock.ExitWriteLock();
			}
		}
开发者ID:nberardi,项目名称:ravendb,代码行数:31,代码来源:TransactionalStorage.cs

示例12: Dispose

        public void Dispose()
        {
            var toDispose = new[]
                            {
                                documents, 
                                queue, 
                                lists, 
                                directories, 
                                files, 
                                indexesStats, 
                                indexesStatsReduce, 
                                indexesEtags, 
                                scheduledReductions, 
                                mappedResults, 
                                reducedResults, 
                                tasks, 
                                identity, 
                                details, 
                                reduceKeysCounts, 
                                reduceKeysStatus, 
                                indexedDocumentsReferences
                            };

            var aggregator = new ExceptionAggregator("DocumentStorageActions disposal error.");

            foreach (var dispose in toDispose)
            {
                if (dispose == null)
                    continue;

                aggregator.Execute(() => dispose.Dispose());
            }

            aggregator.Execute(() =>
            {
            if (Equals(dbid, JET_DBID.Nil) == false && session != null)
                Api.JetCloseDatabase(session.JetSesid, dbid, CloseDatabaseGrbit.None);
            });

            aggregator.Execute(() =>
            {
            if (sessionAndTransactionDisposer != null)
                sessionAndTransactionDisposer();
            });

            aggregator.ThrowIfNeeded();
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:47,代码来源:General.cs

示例13: Dispose

        public void Dispose()
        {
            var ea = new ExceptionAggregator("Cannot dispose server");
            ea.Execute(owinEmbeddedHost.Dispose);
            if (server != null)
                ea.Execute(server.Dispose);

            ea.ThrowIfNeeded();
        }
开发者ID:nuvotex,项目名称:ravendb,代码行数:9,代码来源:OwinHttpServer.cs

示例14: Dispose

        public void Dispose()
        {
            var tryEnterWriteLock = disposerLock.TryEnterWriteLock(TimeSpan.FromMinutes(2));
            try
            {
                if (tryEnterWriteLock == false)
                    log.Warn( "After waiting for 2 minutes, could not aqcuire disposal lock, will force disposal anyway, pending transactions will all error");

                if (disposed)
                    return;

                var exceptionAggregator = new ExceptionAggregator(log, "Could not close database properly");
                disposed = true;
                exceptionAggregator.Execute(current.Dispose);
                if (documentCacher != null)
                    exceptionAggregator.Execute(documentCacher.Dispose);

				if(inFlightTransactionalState != null)
					exceptionAggregator.Execute(inFlightTransactionalState.Dispose);

                exceptionAggregator.Execute(() =>
                    {
                        Api.JetTerm2(instance, TermGrbit.Complete);
                        GC.SuppressFinalize(this);
                    });

                exceptionAggregator.ThrowIfNeeded();
            }
            catch (Exception e)
            {
                log.FatalException("Could not dispose of the transactional storage for " + path, e);
                throw;
            }
            finally
            {
                if (tryEnterWriteLock)
                    disposerLock.ExitWriteLock();
            }
        }
开发者ID:kpantos,项目名称:ravendb,代码行数:39,代码来源:TransactionalStorage.cs

示例15: Dispose

		protected override void Dispose()
		{
			var exceptionAggregator = new ExceptionAggregator(Log, "Could not dispose of IndexingExecuter");
			foreach (var pendingTask in pendingTasks)
			{
				exceptionAggregator.Execute(pendingTask.Wait);
			}
			pendingTasks.Clear();

			exceptionAggregator.Execute(prefetchingBehavior.Dispose);

			if (indexingCompletedEvent != null)
				exceptionAggregator.Execute(indexingCompletedEvent.Dispose);
			if (indexingSemaphore != null)
				exceptionAggregator.Execute(indexingSemaphore.Dispose);
			exceptionAggregator.ThrowIfNeeded();

			indexingCompletedEvent = null;
			indexingSemaphore = null;
		}
开发者ID:urbanfly,项目名称:ravendb,代码行数:20,代码来源:IndexingExecuter.cs


注:本文中的Raven.Database.Impl.ExceptionAggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。