예제 #1
0
 protected override void Dispose(bool value)
 {
     try
     {
         if (_changes.Count > 0)
         {
             _pool.NotifyChanges(_changes);
         }
     }
     finally
     {
         _changes.Clear();
         base.Dispose(value);
     }
 }
예제 #2
0
            protected override void ReturnClient()
            {
                AnkhClientPool pool = (AnkhClientPool)SvnClientPool;

                SvnClientPool = null;

                if (pool == null)
                {
                    Debug.Assert(false, "Returning pool client a second time");
                    return;
                }

                try
                {
                    if (_changes.Count > 0)
                    {
                        pool.NotifyChanges(_changes);
                    }
                }
                finally
                {
                    _changes.Clear();
                }

                if (base.IsCommandRunning || base.IsDisposed)
                {
                    Debug.Assert(!IsCommandRunning, "Returning pool client while it is running");
                    Debug.Assert(!IsDisposed, "Returning pool client while it is disposed");

                    return; // No return on these errors.. Leave it to the GC to clean it up eventually
                }
                else if (!pool.ReturnClient(this))
                {
                    InnerDispose(); // The pool wants to get rid of us
                }
                else
                {
                    SvnClientPool = pool; // Reinstated
                }
            }