@@ -159,12 +159,12 @@ public Future<SqlConnection> getConnection() {
159
159
}
160
160
161
161
public <T > Future <@ Nullable T > withPropagatedTransaction (Function <SqlConnection , Future <@ Nullable T >> function ) {
162
- Context context = Vertx .currentContext ();
162
+ ContextInternal context = ( ContextInternal ) Vertx .currentContext ();
163
163
SqlConnection sqlConnection = context .getLocal (PROPAGATABLE_CONNECTION );
164
164
if (sqlConnection == null ) {
165
165
return initializePropagatedConnectionAndTransaction (function );
166
166
}
167
- return Future .succeededFuture (sqlConnection )
167
+ return context .succeededFuture (sqlConnection )
168
168
.flatMap (conn -> function .apply (conn )
169
169
.onFailure (err -> {
170
170
if (!(err instanceof TransactionRollbackException )) {
@@ -174,7 +174,7 @@ public Future<SqlConnection> getConnection() {
174
174
}
175
175
176
176
private <T > Future <@ Nullable T > initializePropagatedConnectionAndTransaction (Function <SqlConnection , Future <@ Nullable T >> function ) {
177
- Context context = Vertx .currentContext ();
177
+ ContextInternal context = ( ContextInternal ) Vertx .currentContext ();
178
178
return getConnection ().onComplete (handler -> context .putLocal (PROPAGATABLE_CONNECTION , handler .result ()))
179
179
.flatMap (conn -> conn
180
180
.begin ()
@@ -183,14 +183,14 @@ public Future<SqlConnection> getConnection() {
183
183
.compose (
184
184
res -> tx
185
185
.commit ()
186
- .flatMap (v -> Future .succeededFuture (res )),
186
+ .flatMap (v -> context .succeededFuture (res )),
187
187
err -> {
188
188
if (err instanceof TransactionRollbackException ) {
189
- return Future .failedFuture (err );
189
+ return context .failedFuture (err );
190
190
} else {
191
191
return tx
192
192
.rollback ()
193
- .compose (v -> Future .failedFuture (err ), failure -> Future .failedFuture (err ));
193
+ .compose (v -> context .failedFuture (err ), failure -> context .failedFuture (err ));
194
194
}
195
195
}))
196
196
.onComplete (ar -> conn .close (v -> context .removeLocal (PROPAGATABLE_CONNECTION ))));
0 commit comments