/// <summary>
        /// Executes a Commit RPC asynchronously.
        /// </summary>
        /// <param name="request">The commit request. Must not be null. The request will be modified with session and transaction details
        /// from this object.</param>
        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
        /// <returns>A task representing the asynchronous operation. When the task completes, the result is the response from the RPC.</returns>
        public Task <CommitResponse> CommitAsync(CommitRequest request, CallSettings callSettings)
        {
            CheckNotDisposed();
            GaxPreconditions.CheckNotNull(request, nameof(request));
            GaxPreconditions.CheckState(TransactionId != null, "Cannot commit a PooledSession with no associated transaction");
            request.SessionAsSessionName = SessionName;
            request.TransactionId        = TransactionId;

            return(RecordSuccessAndExpiredSessions(Client.CommitAsync(request, callSettings)));
        }
        /// <summary>
        /// Executes a Commit RPC asynchronously.
        /// </summary>
        /// <param name="request">The commit request. Must not be null. The request will be modified with session and transaction details
        /// from this object.</param>
        /// <param name="timeoutSeconds">The timeout for this RPC, in seconds.</param>
        /// <param name="cancellationToken">An optional token for canceling the call.</param>
        /// <returns>A task representing the asynchronous operation. When the task completes, the result is the response from the RPC.</returns>
        public Task <CommitResponse> CommitAsync(CommitRequest request, int timeoutSeconds, CancellationToken cancellationToken)
        {
            CheckNotDisposed();
            GaxPreconditions.CheckNotNull(request, nameof(request));
            GaxPreconditions.CheckState(TransactionId != null, "Cannot commit a PooledSession with no associated transaction");
            request.SessionAsSessionName = SessionName;
            request.TransactionId        = TransactionId;

            var settings = CreateSettings(Client.Settings.CommitSettings, timeoutSeconds, cancellationToken);

            return(RecordSuccessAndExpiredSessions(Client.CommitAsync(request, settings)));
        }
Example #3
0
        /// <summary>
        /// Executes a Commit RPC asynchronously.
        /// </summary>
        /// <param name="request">The commit request. Must not be null. The request will be modified with session and transaction details
        /// from this object.</param>
        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
        /// <returns>A task representing the asynchronous operation. When the task completes, the result is the response from the RPC.</returns>
        public async Task <CommitResponse> CommitAsync(CommitRequest request, CallSettings callSettings)
        {
            CheckNotDisposed();
            GaxPreconditions.CheckNotNull(request, nameof(request));
            GaxPreconditions.CheckState(TransactionId != null, "Cannot commit a PooledSession with no associated transaction");
            request.SessionAsSessionName = SessionName;
            request.TransactionId        = TransactionId;

            var response = await RecordSuccessAndExpiredSessions(Client.CommitAsync(request, callSettings)).ConfigureAwait(false);

            MarkAsCommittedOrRolledBack();
            return(response);
        }
 partial void Modify_CommitRequest(ref CommitRequest request, ref CallSettings settings) =>
 ApplyResourcePrefixHeaderFromSession(ref settings, request.Session);