Skip to content

Commit f5cf596

Browse files
committed
Switched options order for the convenient api
JAVA-3379
1 parent 11fe5a8 commit f5cf596

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

driver-sync/src/main/com/mongodb/client/ClientSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ public interface ClientSession extends com.mongodb.session.ClientSession {
117117
* Execute the given function within a transaction.
118118
*
119119
* @param <T> the return type of the transaction body
120-
* @param options the transaction options
121120
* @param transactionBody the body of the transaction
121+
* @param options the transaction options
122122
* @return the return value of the transaction body
123123
* @mongodb.server.release 4.0
124124
* @since 3.11
125125
*/
126-
<T> T withTransaction(TransactionOptions options, TransactionBody<T> transactionBody);
126+
<T> T withTransaction(TransactionBody<T> transactionBody, TransactionOptions options);
127127
}

driver-sync/src/main/com/mongodb/client/internal/ClientSessionImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ private void unpinServerAddressOnError(final MongoException e) {
179179

180180
@Override
181181
public <T> T withTransaction(final TransactionBody<T> transactionBody) {
182-
return withTransaction(TransactionOptions.builder().build(), transactionBody);
182+
return withTransaction(transactionBody, TransactionOptions.builder().build());
183183
}
184184

185185
@Override
186-
public <T> T withTransaction(final TransactionOptions options, final TransactionBody<T> transactionBody) {
186+
public <T> T withTransaction(final TransactionBody<T> transactionBody, final TransactionOptions options) {
187187
notNull("transactionBody", transactionBody);
188188
long startTime = ClientSessionClock.INSTANCE.now();
189189
outer:

driver-sync/src/test/functional/com/mongodb/client/AbstractTransactionsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ public Void execute() {
354354
}
355355
});
356356
} else {
357-
nonNullClientSession(clientSession).withTransaction(transactionOptions, new TransactionBody<Object>() {
357+
nonNullClientSession(clientSession).withTransaction(new TransactionBody<Object>() {
358358
@Override
359359
public Void execute() {
360360
executeOperations(arguments.getDocument("callback").getArray("operations"), true);
361361
return null;
362362
}
363-
});
363+
}, transactionOptions);
364364
}
365365
} else if (operationName.equals("targetedFailPoint")) {
366366
assertTrue(failPoint == null);

0 commit comments

Comments
 (0)