/// <summary> /// Returns the client to the threadpool, or disposes the cleint /// </summary> protected virtual void ReturnClient() { // In our common implementation this code is not used // Update VisualGitGitClientPool.VisualGitGitPoolClient if (_nReturns++ > 32 || IsCommandRunning || !_pool.ReturnClient(this)) { // Recycle the GitClient if at least one of the following is true // * A command is still active in it (User error) // * The pool doesn't accept the client (Pool error) // * The client has handled 32 sessions (Garbage collection of apr memory) _pool = null; InnerDispose(); } }
// Note: We can only implement our own Dispose over the existing // As VC++ unconditionally calls GC.SuppressFinalize() just before returning // Luckily the using construct uses the last defined or IDisposable methods which we can override protected GitPoolClient(IGitClientPool pool) { if (pool == null) throw new ArgumentNullException("pool"); _pool = pool; }