private async Task DeleteSessionAsync(PooledSession session) { try { await _client.DeleteSessionAsync(new DeleteSessionRequest { SessionName = session.SessionName }).ConfigureAwait(false); } catch (RpcException e) { _logger.Warn("Failed to delete session. Session will be abandoned to garbage collection.", e); } }
public abstract void Release(PooledSession session, bool deleteSession);
// TODO: Rename? /// <summary> /// Creates a <see cref="PooledSession"/> with a known name and transaction ID/mode, with the client associated /// with this pool, but is otherwise not part of this pool. This method does not query the server for the session state. /// When the returned <see cref="PooledSession"/> is released, it will not become part of this pool. /// </summary> /// <param name="sessionName">The name of the transaction. Must not be null.</param> /// <param name="transactionId">The ID of the transaction. Must not be null.</param> /// <param name="transactionMode">The mode of the transaction.</param> /// <returns>A <see cref="PooledSession"/> for the given session and transaction.</returns> public PooledSession RecreateSession(SessionName sessionName, ByteString transactionId, ModeOneofCase transactionMode) { GaxPreconditions.CheckNotNull(sessionName, nameof(sessionName)); GaxPreconditions.CheckNotNull(transactionId, nameof(transactionId)); return(PooledSession.FromSessionName(_detachedSessionPool, sessionName).WithTransaction(transactionId, transactionMode)); }
private void DeleteSessionFireAndForget(PooledSession session) { ConsumeBackgroundTask(DeleteSessionAsync(session), "session deletion"); }