Skip to content

Commit 4622560

Browse files
committed
Add missing withTransaction method - fixes #1284
1 parent e2c4587 commit 4622560

File tree

1 file changed

+11
-0
lines changed
  • vertx-sql-client/src/main/java/io/vertx/sqlclient

1 file changed

+11
-0
lines changed

vertx-sql-client/src/main/java/io/vertx/sqlclient/Pool.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,17 @@ default <T> void withTransaction(Function<SqlConnection, Future<@Nullable T>> fu
172172
* Like {@link #withTransaction(Function, Handler)} but allows for setting the mode, defining how the acquired
173173
* connection is managed during the execution of the function.
174174
*/
175+
default <T> void withTransaction(TransactionPropagation txPropagation, Function<SqlConnection, Future<@Nullable T>> function, Handler<AsyncResult<@Nullable T>> handler) {
176+
Future<T> res = withTransaction(txPropagation, function);
177+
if (handler != null) {
178+
res.onComplete(handler);
179+
}
180+
}
181+
182+
/**
183+
* Like {@link #withTransaction(Function)} but allows for setting the mode, defining how the acquired
184+
* connection is managed during the execution of the function.
185+
*/
175186
default <T> Future<@Nullable T> withTransaction(TransactionPropagation txPropagation, Function<SqlConnection, Future<@Nullable T>> function) {
176187
if (txPropagation == TransactionPropagation.CONTEXT) {
177188
ContextInternal context = (ContextInternal) Vertx.currentContext();

0 commit comments

Comments
 (0)