public override void OnAutoFlush(AutoFlushEvent @event)
 {
     try {
         base.OnAutoFlush(@event);
     }
     catch (AssertionFailure) {
     }
 }
Пример #2
0
 /// <summary>
 /// Called when [auto flush].
 /// </summary>
 /// <param name="event">The @event.</param>
 public override void OnAutoFlush(AutoFlushEvent @event)
 {
     try
     {
         base.OnAutoFlush(@event);
     }
     catch (AssertionFailure e)
     {
         Logger.WarnException("AssertionFailure occurred in " + GetType().Name, e);
     }
 }
        /// <summary>
        /// Handle the given auto-flush event.
        /// </summary>
        /// <param name="event">The auto-flush event to be handled.</param>
        /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
        public virtual async Task OnAutoFlushAsync(AutoFlushEvent @event, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            IEventSource source = @event.Session;

            if (FlushMightBeNeeded(source))
            {
                using (source.SuspendAutoFlush())
                {
                    int oldSize = source.ActionQueue.CollectionRemovalsCount;

                    await(FlushEverythingToExecutionsAsync(@event, cancellationToken)).ConfigureAwait(false);

                    if (FlushIsReallyNeeded(@event, source))
                    {
                        if (log.IsDebugEnabled)
                        {
                            log.Debug("Need to execute flush");
                        }

                        await(PerformExecutionsAsync(source, cancellationToken)).ConfigureAwait(false);
                        PostFlush(source);
                        // note: performExecutions() clears all collectionXxxxtion
                        // collections (the collection actions) in the session

                        if (source.Factory.Statistics.IsStatisticsEnabled)
                        {
                            source.Factory.StatisticsImplementor.Flush();
                        }
                    }
                    else
                    {
                        if (log.IsDebugEnabled)
                        {
                            log.Debug("Dont need to execute flush");
                        }
                        source.ActionQueue.ClearFromFlushNeededCheck(oldSize);
                    }

                    @event.FlushRequired = FlushIsReallyNeeded(@event, source);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Handle the given auto-flush event.
        /// </summary>
        /// <param name="event">The auto-flush event to be handled.</param>
        public virtual void OnAutoFlush(AutoFlushEvent @event)
        {
            IEventSource source = @event.Session;

            if (FlushMightBeNeeded(source))
            {
                using (source.SuspendAutoFlush())
                {
                    int oldSize = source.ActionQueue.CollectionRemovalsCount;

                    FlushEverythingToExecutions(@event);

                    if (FlushIsReallyNeeded(@event, source))
                    {
                        if (log.IsDebugEnabled())
                        {
                            log.Debug("Need to execute flush");
                        }

                        PerformExecutions(source);
                        PostFlush(source);
                        // note: performExecutions() clears all collectionXxxxtion
                        // collections (the collection actions) in the session

                        if (source.Factory.Statistics.IsStatisticsEnabled)
                        {
                            source.Factory.StatisticsImplementor.Flush();
                        }
                    }
                    else
                    {
                        if (log.IsDebugEnabled())
                        {
                            log.Debug("Dont need to execute flush");
                        }
                        source.ActionQueue.ClearFromFlushNeededCheck(oldSize);
                    }

                    @event.FlushRequired = FlushIsReallyNeeded(@event, source);
                }
            }
        }
		/// <summary>
		/// Handle the given auto-flush event.
		/// </summary>
		/// <param name="event">The auto-flush event to be handled.</param>
		public virtual void OnAutoFlush(AutoFlushEvent @event)
		{
			IEventSource source = @event.Session;

			if (FlushMightBeNeeded(source))
			{
				int oldSize = source.ActionQueue.CollectionRemovalsCount;

				FlushEverythingToExecutions(@event);

				if (FlushIsReallyNeeded(@event, source))
				{
					if (log.IsDebugEnabled)
						log.Debug("Need to execute flush");

					PerformExecutions(source);
					PostFlush(source);
					// note: performExecutions() clears all collectionXxxxtion
					// collections (the collection actions) in the session

					if (source.Factory.Statistics.IsStatisticsEnabled)
					{
						source.Factory.StatisticsImplementor.Flush();
					}
				}
				else
				{

					if (log.IsDebugEnabled)
						log.Debug("Dont need to execute flush");
					source.ActionQueue.ClearFromFlushNeededCheck(oldSize);
				}

				@event.FlushRequired = FlushIsReallyNeeded(@event, source);
			}
		}
Пример #6
0
 private bool FlushIsReallyNeeded(AutoFlushEvent @event, IEventSource source)
 {
     return(source.ActionQueue.AreTablesToBeUpdated(@event.QuerySpaces) || ((ISessionImplementor)source).FlushMode == FlushMode.Always);
 }
		private bool FlushIsReallyNeeded(AutoFlushEvent @event, IEventSource source)
		{
			return source.ActionQueue.AreTablesToBeUpdated(@event.QuerySpaces) || ((ISessionImplementor)source).FlushMode == FlushMode.Always;
		}
Пример #8
0
 public void OnAutoFlush(AutoFlushEvent e)
 {
     OnFlushInternal(e);
 }
Пример #9
0
 public void OnAutoFlush(AutoFlushEvent @event)
 {
     log.Debug("AutoFlushEvent :" + @event);
 }