if (!other.getSession().isEmpty()) { session_ = other.session_; onChanged(); bitField0_ = (bitField0_ & ~0x00000008); } else { ensureMutationsIsMutable(); mutations_.addAll(other.mutations_); onChanged(); mutationsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getMutationsFieldBuilder() : null; } else { case TRANSACTION_ID: setTransactionId(other.getTransactionId()); break; mergeSingleUseTransaction(other.getSingleUseTransaction()); break; this.mergeUnknownFields(other.unknownFields); onChanged(); return this;
private com.google.protobuf.RepeatedFieldBuilderV3< com.google.spanner.v1.Mutation, com.google.spanner.v1.Mutation.Builder, com.google.spanner.v1.MutationOrBuilder> getMutationsFieldBuilder() { if (mutationsBuilder_ == null) { mutationsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.spanner.v1.Mutation, com.google.spanner.v1.Mutation.Builder, com.google.spanner.v1.MutationOrBuilder>( mutations_, ((bitField0_ & 0x00000008) == 0x00000008), getParentForChildren(), isClean()); mutations_ = null; } return mutationsBuilder_; }
/** * * * <pre> * Execute mutations in a temporary transaction. Note that unlike * commit of a previously-started transaction, commit with a * temporary transaction is non-idempotent. That is, if the * `CommitRequest` is sent to Cloud Spanner more than once (for * instance, due to retries in the application, or in the * transport library), it is possible that the mutations are * executed more than once. If this is undesirable, use * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and * [Commit][google.spanner.v1.Spanner.Commit] instead. * </pre> * * <code>.google.spanner.v1.TransactionOptions single_use_transaction = 3;</code> */ public com.google.spanner.v1.TransactionOptions.Builder getSingleUseTransactionBuilder() { return getSingleUseTransactionFieldBuilder().getBuilder(); } /**
.setSession(session) .setSingleUseTransaction(singleUseTransaction) .addAllMutations(mutations) .build(); return commit(request);
.setSession(session == null ? null : session.toString()) .setSingleUseTransaction(singleUseTransaction) .addAllMutations(mutations) .build(); return commit(request);
void commit() { span.addAnnotation("Starting Commit"); CommitRequest.Builder builder = CommitRequest.newBuilder().setSession(session.getName()).setTransactionId(transactionId); synchronized (lock) { if (!mutations.isEmpty()) { List<com.google.spanner.v1.Mutation> mutationsProto = new ArrayList<>(); Mutation.toProto(mutations, mutationsProto); builder.addAllMutations(mutationsProto); final CommitRequest commitRequest = builder.build(); Span opSpan = tracer.spanBuilderWithExplicitParent(COMMIT, span).startSpan(); try (Scope s = tracer.withSpan(opSpan)) {
.setSession(session) .setTransactionId(transactionId) .addAllMutations(mutations) .build(); return commit(request);
.setSession(session == null ? null : session.toString()) .setTransactionId(transactionId) .addAllMutations(mutations) .build(); return commit(request);
final CommitRequest request = CommitRequest.newBuilder() .setSession(name) .addAllMutations(mutationsProto) .setSingleUseTransaction( TransactionOptions.newBuilder() .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance())) .build(); Span span = tracer.spanBuilder(COMMIT).startSpan(); try (Scope s = tracer.withSpan(span)) {
.setSession(session) .setSingleUseTransaction(singleUseTransaction) .addAllMutations(mutations) .build(); return commit(request);
.setSession(session == null ? null : session.toString()) .setSingleUseTransaction(singleUseTransaction) .addAllMutations(mutations) .build(); return commit(request);
com.google.spanner.v1.TransactionOptionsOrBuilder>( (com.google.spanner.v1.TransactionOptions) transaction_, getParentForChildren(), isClean()); transaction_ = null; onChanged();
.setSession(session == null ? null : session.toString()) .setTransactionId(transactionId) .addAllMutations(mutations) .build(); return commit(request);
.setSession(session) .setTransactionId(transactionId) .addAllMutations(mutations) .build(); return commit(request);
void commit() { span.addAnnotation("Starting Commit"); CommitRequest.Builder builder = CommitRequest.newBuilder().setSession(session.getName()).setTransactionId(transactionId); synchronized (lock) { if (!mutations.isEmpty()) { List<com.google.spanner.v1.Mutation> mutationsProto = new ArrayList<>(); Mutation.toProto(mutations, mutationsProto); builder.addAllMutations(mutationsProto); final CommitRequest commitRequest = builder.build(); Span opSpan = tracer.spanBuilderWithExplicitParent(COMMIT, span).startSpan(); try (Scope s = tracer.withSpan(opSpan)) {
final CommitRequest request = CommitRequest.newBuilder() .setSession(name) .addAllMutations(mutationsProto) .setSingleUseTransaction( TransactionOptions.newBuilder() .setReadWrite(TransactionOptions.ReadWrite.getDefaultInstance())) .build(); Span span = tracer.spanBuilder(COMMIT).startSpan(); try (Scope s = tracer.withSpan(span)) {
/** * * * <pre> * The mutations to be executed when this transaction commits. All * mutations are applied atomically, in the order they appear in * this list. * </pre> * * <code>repeated .google.spanner.v1.Mutation mutations = 4;</code> */ public Builder addMutations(int index, com.google.spanner.v1.Mutation value) { if (mutationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMutationsIsMutable(); mutations_.add(index, value); onChanged(); } else { mutationsBuilder_.addMessage(index, value); } return this; } /**
/** * * * <pre> * The mutations to be executed when this transaction commits. All * mutations are applied atomically, in the order they appear in * this list. * </pre> * * <code>repeated .google.spanner.v1.Mutation mutations = 4;</code> */ public Builder setMutations(int index, com.google.spanner.v1.Mutation value) { if (mutationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMutationsIsMutable(); mutations_.set(index, value); onChanged(); } else { mutationsBuilder_.setMessage(index, value); } return this; } /**
/** * * * <pre> * The mutations to be executed when this transaction commits. All * mutations are applied atomically, in the order they appear in * this list. * </pre> * * <code>repeated .google.spanner.v1.Mutation mutations = 4;</code> */ public Builder addMutations(com.google.spanner.v1.Mutation value) { if (mutationsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMutationsIsMutable(); mutations_.add(value); onChanged(); } else { mutationsBuilder_.addMessage(value); } return this; } /**
/** * * * <pre> * The mutations to be executed when this transaction commits. All * mutations are applied atomically, in the order they appear in * this list. * </pre> * * <code>repeated .google.spanner.v1.Mutation mutations = 4;</code> */ public Builder addAllMutations( java.lang.Iterable<? extends com.google.spanner.v1.Mutation> values) { if (mutationsBuilder_ == null) { ensureMutationsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, mutations_); onChanged(); } else { mutationsBuilder_.addAllMessages(values); } return this; } /**