Exemplo n.º 1
0
 /// <summary>
 /// Returns this session to the session pool from which it was acquired, unless
 /// it has become invalid. This method should only be called once per instance; subsequent
 /// calls are ignored. No other methods can be called after this.
 /// </summary>
 /// <param name="forceDelete">true to force the session to be deleted; false to allow the session to be reused.</param>
 public void ReleaseToPool(bool forceDelete)
 {
     if (MarkAsDisposed())
     {
         _pool.Release(AfterReset(), forceDelete || ServerExpired || ShouldBeEvicted);
     }
     else
     {
         // Log?
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns this session to the session pool from which it was acquired, unless
        /// it has become invalid. This method should only be called once per instance; subsequent
        /// calls are ignored. No other methods can be called after this.
        /// </summary>
        /// <param name="forceDelete">true to force the session to be deleted; false to allow the session to be reused.</param>
        public void ReleaseToPool(bool forceDelete)
        {
            bool wasDisposed = Interlocked.Exchange(ref _disposed, 1) == 1;

            if (!wasDisposed)
            {
                _pool.Release(AfterReset(), forceDelete || ServerExpired || ShouldBeEvicted);
            }
            else
            {
                // Log?
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Returns this session to the session pool from which it was acquired, unless
 /// it has become invalid. This method should only be called once per instance; subsequent
 /// calls are ignored. No other methods can be called after this.
 /// </summary>
 /// <param name="forceDelete">true to force the session to be deleted; false to allow the session to be reused.</param>
 public void ReleaseToPool(bool forceDelete)
 {
     if (MarkAsDisposed())
     {
         // A read/write transaction that hasn't been committed or rolled back might have taken out a database lock: roll it
         // back as part of releasing the session. (We don't block on the rollback happening though.)
         ByteString transactionToRollback = TransactionMode == ModeOneofCase.ReadWrite && !IsCommittedOrRolledBack() ? TransactionId : null;
         _pool.Release(AfterReset(), transactionToRollback, forceDelete || ServerExpired || ShouldBeEvicted);
     }
     else
     {
         // Log?
     }
 }