Skip to content

Commit 308dca5

Browse files
committed
very minor javadoc fixes
1 parent 5d1de60 commit 308dca5

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/Mutiny.java

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ interface SessionFactory extends AutoCloseable {
20302030

20312031

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

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

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

20942094
/**
2095-
* Perform work using a {@link Session reactive session} within an
2096-
* associated transaction.
2095+
* Perform work using a {@linkplain Session reactive session}
2096+
* within an associated transaction.
20972097
* <p>
20982098
* <il>
2099-
* <li>If there is already a session associated with the
2100-
* current reactive stream, then the work will be executed using that
2099+
* <li>If there is already a session associated with the current
2100+
* reactive stream, then the work will be executed using that
21012101
* session.
21022102
* <li>Otherwise, if there is no session associated with the
21032103
* current stream, a new session will be created.
@@ -2117,8 +2117,8 @@ default <T> Uni<T> withTransaction(Function<Session, Uni<T>> work) {
21172117
}
21182118

21192119
/**
2120-
* Perform work using a {@link StatelessSession reactive session} within an
2121-
* associated {@link Transaction transaction}.
2120+
* Perform work using a {@linkplain StatelessSession reactive session}
2121+
* within an associated {@link Transaction transaction}.
21222122
* <p>
21232123
* <il>
21242124
* <li>If there is already a stateless session associated with the
@@ -2128,10 +2128,11 @@ default <T> Uni<T> withTransaction(Function<Session, Uni<T>> work) {
21282128
* current stream, a new stateless session will be created.
21292129
* </il>
21302130
* <p>
2131-
* The session will be closed automatically and the transaction committed automatically.
2131+
* The session will be closed automatically and the transaction committed
2132+
* automatically.
21322133
*
2133-
* @param work a function which accepts the stateless session and returns
2134-
* the result of the work as a {@link Uni}.
2134+
* @param work a function which accepts the stateless session and
2135+
* returns the result of the work as a {@link Uni}.
21352136
*
21362137
* @see #withStatelessSession(Function)
21372138
* @see StatelessSession#withTransaction(Function)
@@ -2141,8 +2142,8 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
21412142
}
21422143

21432144
/**
2144-
* Perform work using a {@link StatelessSession reactive session} within an
2145-
* associated {@link Transaction transaction}.
2145+
* Perform work using a {@linkplain StatelessSession reactive session}
2146+
* within an associated {@link Transaction transaction}.
21462147
* <p>
21472148
* <il>
21482149
* <li>If there is already a stateless session associated with the
@@ -2152,7 +2153,8 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
21522153
* current stream, a new stateless session will be created.
21532154
* </il>
21542155
* <p>
2155-
* The session will be closed automatically and the transaction committed automatically.
2156+
* The session will be closed automatically and the transaction committed
2157+
* automatically.
21562158
*
21572159
* @param work a function which accepts the stateless session and returns
21582160
* the result of the work as a {@link Uni}.
@@ -2163,7 +2165,7 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
21632165
<T> Uni<T> withStatelessTransaction(BiFunction<StatelessSession, Transaction, Uni<T>> work);
21642166

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

21832185
/**
2184-
* Perform work using a {@link StatelessSession stateless session}.
2186+
* Perform work using a {@linkplain StatelessSession stateless session}.
21852187
* <p>
21862188
* <il>
21872189
* <li>If there is already a stateless session associated with the
2188-
* current reactive stream and given tenant id, then the work will be executed using that
2189-
* session.
2190+
* current reactive stream and given tenant id, then the work will be
2191+
* executed using that session.
21902192
* <li>Otherwise, if there is no stateless session associated with the
2191-
* current stream and given tenant id, a new stateless session will be created.
2193+
* current stream and given tenant id, a new stateless session will be
2194+
* created.
21922195
* </il>
21932196
* <p>
21942197
* The session will be closed automatically.
@@ -2200,15 +2203,16 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
22002203
<T> Uni<T> withStatelessSession(String tenantId, Function<StatelessSession, Uni<T>> work);
22012204

22022205
/**
2203-
* Perform work using a {@link Session reactive session} for a
2206+
* Perform work using a {@linkplain Session reactive session} for a
22042207
* specified tenant within an associated {@link Transaction transaction}.
22052208
* <p>
22062209
* <il>
22072210
* <li>If there is already a session associated with the
2208-
* current reactive stream and given tenant id, then the work will be executed using that
2209-
* session.
2211+
* current reactive stream and given tenant id, then the work
2212+
* will be executed using that session.
22102213
* <li>Otherwise, if there is no session associated with the
2211-
* current stream and given tenant id, a new stateless session will be created.
2214+
* current stream and given tenant id, a new stateless session
2215+
* will be created.
22122216
* </il>
22132217
* <p>
22142218
* The session will be {@link Session#flush() flushed} and closed
@@ -2224,18 +2228,20 @@ default <T> Uni<T> withStatelessTransaction(Function<StatelessSession, Uni<T>> w
22242228
<T> Uni<T> withTransaction(String tenantId, BiFunction<Session, Transaction, Uni<T>> work);
22252229

22262230
/**
2227-
* Perform work using a {@link StatelessSession reactive session} for a
2228-
* specified tenant within an associated {@link Transaction transaction}.
2231+
* Perform work using a {@linkplain StatelessSession reactive session} for
2232+
* a specified tenant within an associated {@link Transaction transaction}.
22292233
* <p>
22302234
* <il>
22312235
* <li>If there is already a stateless session associated with the
2232-
* current reactive stream and given tenant id, then the work will be executed using that
2233-
* session.
2236+
* current reactive stream and given tenant id, then the work will be
2237+
* executed using that session.
22342238
* <li>Otherwise, if there is no stateless session associated with the
2235-
* current stream and given tenant id, a new stateless session will be created.
2239+
* current stream and given tenant id, a new stateless session will be
2240+
* created.
22362241
* </il>
22372242
* <p>
2238-
* The session will be closed automatically and the transaction committed automatically.
2243+
* The session will be closed automatically and the transaction committed
2244+
* automatically.
22392245
*
22402246
* @param tenantId the id of the tenant
22412247
* @param work a function which accepts the stateless session and returns

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/impl/MutinyStatelessSessionImpl.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ public Mutiny.Transaction currentTransaction() {
300300
private class Transaction<T> implements Mutiny.Transaction {
301301
boolean rollback;
302302

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

310314
/**
311-
* Run the code assuming that a transaction has already started so that we can
312-
* differentiate an error starting a transaction (and therefore doesn't need to rollback)
313-
* and an error thrown by the work.
315+
* Run the code assuming that a transaction has already started
316+
* so that we can differentiate an error starting a transaction
317+
* (which therefore does not need to trigger rollback) from an
318+
* error thrown by the work (which does).
314319
*/
315320
Uni<T> executeInTransaction(Function<Mutiny.Transaction, Uni<T>> work) {
316321
return Uni.createFrom().deferred( () -> work.apply( this ) )
317322
// in the case of an exception or cancellation
318-
// we need to rollback the transaction
323+
// we need to roll back the transaction
319324
.onFailure().call( this::rollback )
320325
.onCancellation().call( this::rollback )
321326
// finally, when there was no exception,

0 commit comments

Comments
 (0)