public void Observe(StatementLifecycleEvent theEvent)
 {
     if (theEvent.EventType == StatementLifecycleEvent.LifecycleEventType.CREATE)
     {
         IEnumerator <EPStatementStateListener> it = _statementListeners.GetEnumerator();
         for (; it.MoveNext();)
         {
             try
             {
                 it.Current.OnStatementCreate(_serviceProvider, theEvent.Statement);
             }
             catch (Exception ex)
             {
                 Log.Error("Caught runtime exception in onStatementCreate callback:" + ex.Message, ex);
             }
         }
     }
     else if (theEvent.EventType == StatementLifecycleEvent.LifecycleEventType.STATECHANGE)
     {
         IEnumerator <EPStatementStateListener> it = _statementListeners.GetEnumerator();
         for (; it.MoveNext();)
         {
             try
             {
                 it.Current.OnStatementStateChange(_serviceProvider, theEvent.Statement);
             }
             catch (Exception ex)
             {
                 Log.Error("Caught runtime exception in onStatementCreate callback:" + ex.Message, ex);
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Raises the <see cref="StatementStateChange"/> event.
 /// </summary>
 /// <param name="e">The <see cref="StatementLifecycleEvent"/> instance containing the event data.</param>
 protected virtual void OnStatementStateChanged(StatementLifecycleEvent e)
 {
     if (StatementStateChange != null)
     {
         StatementStateChange(this, new StatementStateEventArgs(this, e.Statement));
     }
 }
Пример #3
0
        /// <summary>
        /// Handles the lifecycle event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="StatementLifecycleEvent"/> instance containing the event data.</param>
        private void HandleLifecycleEvent(object sender, StatementLifecycleEvent e)
        {
            switch (e.EventType)
            {
            case StatementLifecycleEvent.LifecycleEventType.CREATE:
                OnStatementCreate(new StatementStateEventArgs(this, e.Statement));
                break;

            case StatementLifecycleEvent.LifecycleEventType.STATECHANGE:
                OnStatementStateChanged(e);
                break;
            }
        }