Skip to content

Commit

Permalink
fixup! fix(db): correct use of Transactional annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Apr 26, 2024
1 parent 6079b34 commit 9f8ceed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/io/cryostat/targets/TargetConnectionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.github.benmanes.caffeine.cache.RemovalCause;
import com.github.benmanes.caffeine.cache.Scheduler;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.quarkus.narayana.jta.QuarkusTransaction;
import io.quarkus.vertx.ConsumeEvent;
import io.smallrye.mutiny.Uni;
import io.smallrye.mutiny.unchecked.Unchecked;
Expand Down Expand Up @@ -298,8 +299,13 @@ private void closeConnection(URI connectUrl, JFRConnection connection, RemovalCa
}

JFRConnection connect(URI connectUrl) throws Exception {
var credentials = credentialsFinder.getCredentialsForConnectUrl(connectUrl);
return connect(connectUrl, credentials);
return QuarkusTransaction.joiningExisting()
.call(
() -> {
var credentials =
credentialsFinder.getCredentialsForConnectUrl(connectUrl);
return connect(connectUrl, credentials);
});
}

JFRConnection connect(URI connectUrl, Optional<Credential> credentials) throws Exception {
Expand Down

0 comments on commit 9f8ceed

Please sign in to comment.