Ejemplo n.º 1
0
 /// <summary>
 ///     Unsubscribe from receiving notification when the transaction ends.
 /// </summary>
 /// <param name="subscriber">
 ///     The subscriber not to be notified when the transaction ends.
 /// </param>
 /// <returns>
 ///     <see langword="true"/> the subscriber was successfully unsubscribed
 ///     <see langword="false"/> the subscriber was not subscribed
 /// </returns>
 /// <remarks>
 ///     The subscription is OK to handle large number of subscribers.
 /// </remarks>
 public bool Unsubscribe(ITransactionNotification subscriber)
 {
     lock (_watchers)
     {
         return(_watchers.Remove(subscriber));
     }
 }
Ejemplo n.º 2
0
 private void NotifyCompletion(ITransactionNotification subscriber, bool completed)
 {
     try
     {
         subscriber.TransactionCompleted(this, completed);
     }
     catch (TransactionNotificationException e)
     {
         _log.ErrorFormat("Prepare notification failed: {0}", e);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Subscribe to receive notification when the transaction ends.
        /// </summary>
        /// <param name="subscriber">
        ///     The subscriber to be notified when the transaction ends.
        /// </param>
        /// <remarks>
        ///     The subscription is OK to handle large number of subscribers.
        /// </remarks>
        public void Subscribe(ITransactionNotification subscriber)
        {
            Check.DoRequireArgumentNotNull(subscriber, "subscriber");
            Check.DoCheckOperationValid(IsActive, "Transaction is not active");

            EnsureSubscribedToMaster();

            lock (_watchers)
            {
                if (!_watchers.Contains(subscriber))
                {
                    _watchers.Add(subscriber);
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     Subscribe for notification about the completion of the ambient Storage transaction.
 /// </summary>
 /// <param name="subscriber">
 ///     The subscriber to notify.
 /// </param>
 public void SubscribeForAmbientTransactionCompletion(ITransactionNotification subscriber)
 {
     KtmTransaction.Current.Subscribe(subscriber);
 }
 /// <summary>
 ///		Create new instance
 /// </summary>
 /// <param name="repository">
 ///		The repository transactions will operate in.
 /// </param>
 /// <param name="notificationSubscriber">
 ///		Optional external subscriber.
 /// </param>
 public LongSlaveTransactionManager(IRepository repository, ITransactionNotification notificationSubscriber)
 {
     Repository          = repository;
     _fileSystemProvider = Repository.ObjectFactory.FileSystemProvider;
     _subscriber         = notificationSubscriber;
 }