Beispiel #1
0
            internal RemoteDisposable(SecsEventSubscription subscription, Action subscribeAction, Action disposeAction)
            {
                this._subscribeAction = subscribeAction;
                this._disposeAction   = disposeAction;
                this._subscription    = subscription;
                var lease = (ILease)subscription.GetLifetimeService();

                if (lease != null)
                {
                    lease.Register(sponsor);
                }
            }
Beispiel #2
0
 public void Dispose()
 {
     if (!this._isDisposed)
     {
         try
         {
             this._disposeAction();
             this._isDisposed = true;
             var lease = (ILease)_subscription.GetLifetimeService();
             if (lease != null)
             {
                 Trace.WriteLine("Unregister Subscrption.");
                 lease.Unregister(sponsor);
             }
         }
         catch
         {
         }
     }
 }