Esempio n. 1
0
 /// <summary>
 /// Starts the journaler; derived classes may override this method to perform
 /// additional logic when starting. The registration key controls the journaler's
 /// registration with the underlying IEventListener. At the time of the call
 /// the registration is suspended (journaler is not yet receiving LWES events).
 /// It is the responsibility of the derived class to either call the base-class
 /// PerformStart method or activate the registration key. LWES events will not
 /// flow to the journaler until the key has been activated.
 /// </summary>
 /// <param name="registrationKey"></param>
 /// <returns></returns>
 protected virtual bool PerformStart(ISinkRegistrationKey registrationKey)
 {
     if (registrationKey == null) throw new ArgumentNullException("registrationKey");
     return registrationKey.Activate();
 }
Esempio n. 2
0
 /// <summary>
 /// Starts the journaler.
 /// </summary>
 public void Start()
 {
     if (_status.SetStateIfLessThan(JournalerState.Starting, JournalerState.Initialized))
     {
         try
         {
             _registrationKey = _listener.RegisterDataReceiverSink(this);
             // Let the subclass decide if the start succeeded.
             if (PerformStart(_registrationKey) && _registrationKey.Activate())
             {
                 _status.TryTransition(JournalerState.Active, JournalerState.Starting);
             }
         }
         catch (Exception e)
         {
             this.TraceData(TraceEventType.Error, Resources.Error_UnexpectedErrorStartngJournaler, e);
             _status.TryTransition(JournalerState.Initialized, JournalerState.Starting);
         }
     }
 }