Esempio n. 1
0
        public void Dispose()
        {
            disposerLock.EnterWriteLock();
            try
            {
                if (disposed)
                {
                    return;
                }

                disposed = true;

                var exceptionAggregator = new ExceptionAggregator("Could not properly dispose TransactionalStorage");

                exceptionAggregator.Execute(() => current.Dispose());

                if (tableStorage != null)
                {
                    exceptionAggregator.Execute(() => tableStorage.Dispose());
                }

                if (bufferPool != null)
                {
                    exceptionAggregator.Execute(() => bufferPool.Dispose());
                }

                exceptionAggregator.ThrowIfNeeded();
            }
            finally
            {
                disposerLock.ExitWriteLock();
            }
        }
Esempio n. 2
0
 protected override void DisposeCode()
 {
     Reader?.Dispose();
     Writer?.Dispose();
     if (_isNeedDisposePool)
     {
         _bufferPool.Dispose();
     }
 }
Esempio n. 3
0
 public void Dispose() => _pool.Dispose();
Esempio n. 4
0
        /// <summary>
        ///     Set BufferPool to use the specified IBufferPool implementation to manage the buffer-pool.
        /// </summary>
        /// <param name="bufferPool">the implementation of <see cref="IBufferPool" /> to use</param>
        public static void SetCustomBufferPool([NotNull] IBufferPool bufferPool)
        {
            IBufferPool prior = Interlocked.Exchange(ref BufferPool.s_bufferPool, bufferPool);

            prior?.Dispose();
        }