Skip to content

very minor javadoc fixes #2257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ interface SessionFactory extends AutoCloseable {


/**
* Perform work using a {@link Session reactive session}.
* Perform work using a {@linkplain Session reactive session}.
* <p>
* <il>
* <li>If there is already a session associated with the current
Expand All @@ -2049,7 +2049,7 @@ interface SessionFactory extends AutoCloseable {
<T> Uni<T> withSession(Function<Session, Uni<T>> work);

/**
* Perform work using a {@link Session reactive session} for
* Perform work using a {@linkplain Session reactive session} for
* a specified tenant.
* <p>
* <il>
Expand All @@ -2069,12 +2069,12 @@ interface SessionFactory extends AutoCloseable {
<T> Uni<T> withSession(String tenantId, Function<Session, Uni<T>> work);

/**
* Perform work using a {@link Session reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain Session reactive session}
* within an associated {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a session associated with the
* current reactive stream, then the work will be executed using that
* <li>If there is already a session associated with the current
* reactive stream, then the work will be executed using that
* session.
* <li>Otherwise, if there is no session associated with the
* current stream, a new session will be created.
Expand All @@ -2092,12 +2092,12 @@ interface SessionFactory extends AutoCloseable {
<T> Uni<T> withTransaction(BiFunction<Session, Transaction, Uni<T>> work);

/**
* Perform work using a {@link Session reactive session} within an
* associated transaction.
* Perform work using a {@linkplain Session reactive session}
* within an associated transaction.
* <p>
* <il>
* <li>If there is already a session associated with the
* current reactive stream, then the work will be executed using that
* <li>If there is already a session associated with the current
* reactive stream, then the work will be executed using that
* session.
* <li>Otherwise, if there is no session associated with the
* current stream, a new session will be created.
Expand All @@ -2117,8 +2117,8 @@ default <T> Uni<T> withTransaction(Function<Session, Uni<T>> work) {
}

/**
* Perform work using a {@link StatelessSession reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* within an associated {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2128,10 +2128,11 @@ default <T> Uni<T> withTransaction(Function<Session, Uni<T>> work) {
* current stream, a new stateless session will be created.
* </il>
* <p>
* The session will be closed automatically and the transaction committed automatically.
* The session will be closed automatically and the transaction committed
* automatically.
*
* @param work a function which accepts the stateless session and returns
* the result of the work as a {@link Uni}.
* @param work a function which accepts the stateless session and
* returns the result of the work as a {@link Uni}.
*
* @see #withStatelessSession(Function)
* @see StatelessSession#withTransaction(Function)
Expand All @@ -2141,8 +2142,8 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
}

/**
* Perform work using a {@link StatelessSession reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* within an associated {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2152,7 +2153,8 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
* current stream, a new stateless session will be created.
* </il>
* <p>
* The session will be closed automatically and the transaction committed automatically.
* The session will be closed automatically and the transaction committed
* automatically.
*
* @param work a function which accepts the stateless session and returns
* the result of the work as a {@link Uni}.
Expand All @@ -2163,7 +2165,7 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
<T> Uni<T> withStatelessTransaction(BiFunction<StatelessSession, Transaction, Uni<T>> work);

/**
* Perform work using a {@link StatelessSession stateless session}.
* Perform work using a {@linkplain StatelessSession stateless session}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2181,14 +2183,15 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
<T> Uni<T> withStatelessSession(Function<StatelessSession, Uni<T>> work);

/**
* Perform work using a {@link StatelessSession stateless session}.
* Perform work using a {@linkplain StatelessSession stateless session}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
* current reactive stream and given tenant id, then the work will be executed using that
* session.
* current reactive stream and given tenant id, then the work will be
* executed using that session.
* <li>Otherwise, if there is no stateless session associated with the
* current stream and given tenant id, a new stateless session will be created.
* current stream and given tenant id, a new stateless session will be
* created.
* </il>
* <p>
* The session will be closed automatically.
Expand All @@ -2200,15 +2203,17 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
<T> Uni<T> withStatelessSession(String tenantId, Function<StatelessSession, Uni<T>> work);

/**
* Perform work using a {@link Session reactive session} for a
* specified tenant within an associated {@link Transaction transaction}.
* Perform work using a {@linkplain Session reactive session} for
* the tenant with the specified tenant id within an associated
* {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a session associated with the
* current reactive stream and given tenant id, then the work will be executed using that
* session.
* <li>If there is already a session associated with the current
* reactive stream and given tenant id, then the work will be
* executed using that session.
* <li>Otherwise, if there is no session associated with the
* current stream and given tenant id, a new stateless session will be created.
* current stream and given tenant id, a new stateless session
* will be created.
* </il>
* <p>
* The session will be {@link Session#flush() flushed} and closed
Expand All @@ -2224,18 +2229,21 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
<T> Uni<T> withTransaction(String tenantId, BiFunction<Session, Transaction, Uni<T>> work);

/**
* Perform work using a {@link StatelessSession reactive session} for a
* specified tenant within an associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* for the tenant with the specified tenant id within an associated
* {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
* current reactive stream and given tenant id, then the work will be executed using that
* session.
* current reactive stream and given tenant id, then the work will be
* executed using that session.
* <li>Otherwise, if there is no stateless session associated with the
* current stream and given tenant id, a new stateless session will be created.
* current stream and given tenant id, a new stateless session will be
* created.
* </il>
* <p>
* The session will be closed automatically and the transaction committed automatically.
* The session will be closed automatically and the transaction committed
* automatically.
*
* @param tenantId the id of the tenant
* @param work a function which accepts the stateless session and returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ public Mutiny.Transaction currentTransaction() {
private class Transaction<T> implements Mutiny.Transaction {
boolean rollback;

/**
* Execute the given work in a new transaction. Called only
* when no existing transaction was active.
*/
Uni<T> execute(Function<Mutiny.Transaction, Uni<T>> work) {
currentTransaction = this;
return begin()
Expand All @@ -308,14 +312,15 @@ Uni<T> execute(Function<Mutiny.Transaction, Uni<T>> work) {
}

/**
* Run the code assuming that a transaction has already started so that we can
* differentiate an error starting a transaction (and therefore doesn't need to rollback)
* and an error thrown by the work.
* Run the code assuming that a transaction has already started
* so that we can differentiate an error starting a transaction
* (which therefore does not need to trigger rollback) from an
* error thrown by the work (which does).
*/
Uni<T> executeInTransaction(Function<Mutiny.Transaction, Uni<T>> work) {
return Uni.createFrom().deferred( () -> work.apply( this ) )
// in the case of an exception or cancellation
// we need to rollback the transaction
// we need to roll back the transaction
.onFailure().call( this::rollback )
.onCancellation().call( this::rollback )
// finally, when there was no exception,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ interface Transaction {
interface SessionFactory extends AutoCloseable {

/**
* Obtain a new {@link Session reactive session} {@link CompletionStage}, the main
* Obtain a new {@linkplain Session reactive session} {@link CompletionStage}, the main
* interaction point between the user's program and Hibernate
* Reactive.
* <p>
Expand All @@ -1994,7 +1994,7 @@ interface SessionFactory extends AutoCloseable {
CompletionStage<Session> openSession();

/**
* Obtain a new {@link Session reactive session} {@link CompletionStage} for a
* Obtain a new {@linkplain Session reactive session} {@link CompletionStage} for a
* specified tenant.
* <p>
* When the {@link CompletionStage} completes successfully it returns a newly created session.
Expand Down Expand Up @@ -2033,7 +2033,7 @@ interface SessionFactory extends AutoCloseable {
CompletionStage<StatelessSession> openStatelessSession(String tenantId);

/**
* Perform work using a {@link Session reactive session}.
* Perform work using a {@linkplain Session reactive session}.
* <p>
* <il>
* <li>If there is already a session associated with the current
Expand All @@ -2052,7 +2052,7 @@ interface SessionFactory extends AutoCloseable {
<T> CompletionStage<T> withSession(Function<Session, CompletionStage<T>> work);

/**
* Perform work using a {@link Session reactive session} for a
* Perform work using a {@linkplain Session reactive session} for a
* specified tenant.
* <p>
* <il>
Expand All @@ -2072,7 +2072,7 @@ interface SessionFactory extends AutoCloseable {
<T> CompletionStage<T> withSession(String tenantId, Function<Session, CompletionStage<T>> work);

/**
* Perform work using a {@link Session reactive session} within an
* Perform work using a {@linkplain Session reactive session} within an
* associated {@link Transaction transaction}.
* <p>
* <il>
Expand All @@ -2096,7 +2096,7 @@ interface SessionFactory extends AutoCloseable {
<T> CompletionStage<T> withTransaction(BiFunction<Session, Transaction, CompletionStage<T>> work);

/**
* Perform work using a {@link Session reactive session} within an
* Perform work using a {@linkplain Session reactive session} within an
* associated transaction.
* <p>
* <il>
Expand All @@ -2121,15 +2121,17 @@ default <T> CompletionStage<T> withTransaction(Function<Session, CompletionStage
}

/**
* Perform work using a {@link Session reactive session} for a
* specified tenant within an associated {@link Transaction transaction}.
* Perform work using a {@linkplain Session reactive session} for
* the tenant with the specified tenant id within an associated
* {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a session associated with the
* current reactive stream and the given tenant, then the work will be executed using that
* session.
* <li>Otherwise, if there is no stateless session associated with the
* current stream and the given tenant, a new stateless session will be created.
* <li>If there is already a session associated with the current
* reactive stream and given tenant id, then the work will be
* executed using that session.
* <li>Otherwise, if there is no stateless session associated with
* the current stream and given tenant id, a new stateless session
* will be created.
* </il>
* <p>
* The session will be {@link Session#flush() flushed} and closed
Expand All @@ -2145,8 +2147,8 @@ default <T> CompletionStage<T> withTransaction(Function<Session, CompletionStage
<T> CompletionStage<T> withTransaction(String tenantId, BiFunction<Session, Transaction, CompletionStage<T>> work);

/**
* Perform work using a {@link StatelessSession reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* within an associated {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2156,7 +2158,8 @@ default <T> CompletionStage<T> withTransaction(Function<Session, CompletionStage
* current stream, a new stateless session will be created.
* </il>
* <p>
* The session will be closed automatically, and the transaction committed automatically.
* The session will be closed automatically, and the transaction committed
* automatically.
*
* @param work a function which accepts the stateless session and returns
* the result of the work as a {@link CompletionStage}.
Expand All @@ -2169,8 +2172,8 @@ default <T> CompletionStage<T> withStatelessTransaction(Function<StatelessSessio
}

/**
* Perform work using a {@link StatelessSession reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* within an associated {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2180,7 +2183,8 @@ default <T> CompletionStage<T> withStatelessTransaction(Function<StatelessSessio
* current stream, a new stateless session will be created.
* </il>
* <p>
* The session will be closed automatically, and the transaction committed automatically.
* The session will be closed automatically, and the transaction committed
* automatically.
*
* @param work a function which accepts the stateless session and returns
* the result of the work as a {@link CompletionStage}.
Expand All @@ -2191,18 +2195,21 @@ default <T> CompletionStage<T> withStatelessTransaction(Function<StatelessSessio
<T> CompletionStage<T> withStatelessTransaction(BiFunction<StatelessSession, Transaction, CompletionStage<T>> work);

/**
* Perform work using a {@link StatelessSession reactive session} within an
* associated {@link Transaction transaction}.
* Perform work using a {@linkplain StatelessSession reactive session}
* for the tenant with the specified tenant id within an associated
* {@link Transaction transaction}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
* current reactive stream and the given tenant, then the work will be executed using that
* session.
* current reactive stream and given tenant id, then the work will be
* executed using that session.
* <li>Otherwise, if there is no stateless session associated with the
* current stream, a new stateless session will be created.
* current stream and given tenant id, a new stateless session will be
* created.
* </il>
* <p>
* The session will be closed automatically, and the transaction committed automatically.
* The session will be closed automatically and the transaction committed
* automatically.
*
* @param tenantId the id of the tenant
* @param work a function which accepts the stateless session and returns
Expand All @@ -2214,7 +2221,7 @@ default <T> CompletionStage<T> withStatelessTransaction(Function<StatelessSessio
<T> CompletionStage<T> withStatelessTransaction(String tenantId, BiFunction<StatelessSession, Transaction, CompletionStage<T>> work);

/**
* Perform work using a {@link StatelessSession stateless session}.
* Perform work using a {@linkplain StatelessSession stateless session}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand All @@ -2232,7 +2239,7 @@ default <T> CompletionStage<T> withStatelessTransaction(Function<StatelessSessio
<T> CompletionStage<T> withStatelessSession(Function<StatelessSession, CompletionStage<T>> work);

/**
* Perform work using a {@link StatelessSession stateless session}.
* Perform work using a {@linkplain StatelessSession stateless session}.
* <p>
* <il>
* <li>If there is already a stateless session associated with the
Expand Down
Loading