Skip to content

Commit 78f35e2

Browse files
gavinkingDavideD
authored andcommitted
miscellaneous minor changes
mostly trivial
1 parent 8f6ec56 commit 78f35e2

File tree

8 files changed

+26
-24
lines changed

8 files changed

+26
-24
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/engine/impl/ReactiveEntityIdentityInsertAction.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ private CompletionStage<Void> processInsertGenerated(
9999
Object instance,
100100
SharedSessionContractImplementor session) {
101101
if ( reactivePersister.hasInsertGeneratedProperties() ) {
102-
return reactivePersister
103-
.reactiveProcessInsertGenerated( generatedId, instance, getState(), session );
102+
return reactivePersister.reactiveProcessInsertGenerated( generatedId, instance, getState(), session );
104103
}
105104
return voidFuture();
106105
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/engine/impl/ReactiveEntityInsertAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ default CompletionStage<Void> reactiveMakeEntityManaged() {
7777
return reactiveNullifyTransientReferencesIfNotAlready()
7878
.thenAccept( v -> getSession().getPersistenceContextInternal().addEntity(
7979
getInstance(),
80-
( getPersister().isMutable() ? Status.MANAGED : Status.READ_ONLY ),
80+
getPersister().isMutable() ? Status.MANAGED : Status.READ_ONLY,
8181
getState(),
8282
getEntityKey(),
8383
Versioning.getVersion( getState(), getPersister() ),

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,16 @@ public Mutiny.Session newSession(String tenantId) {
109109
public Uni<Mutiny.Session> openSession() {
110110
SessionCreationOptions options = options();
111111
return uni( () -> connection( options.getTenantIdentifier() ) )
112-
.chain( reactiveConnection -> create( reactiveConnection, () -> new ReactiveSessionImpl( delegate, options, reactiveConnection ) ) )
112+
.chain( reactiveConnection -> create( reactiveConnection,
113+
() -> new ReactiveSessionImpl( delegate, options, reactiveConnection ) ) )
113114
.map( s -> new MutinySessionImpl(s, this) );
114115
}
115116

116117
@Override
117118
public Uni<Mutiny.Session> openSession(String tenantId) {
118119
return uni( () -> connection( tenantId ) )
119-
.chain( reactiveConnection -> create( reactiveConnection, () -> new ReactiveSessionImpl( delegate, options( tenantId ), reactiveConnection ) ) )
120+
.chain( reactiveConnection -> create( reactiveConnection,
121+
() -> new ReactiveSessionImpl( delegate, options( tenantId ), reactiveConnection ) ) )
120122
.map( s -> new MutinySessionImpl(s, this) );
121123
}
122124

@@ -149,14 +151,16 @@ public Mutiny.StatelessSession newStatelessSession(String tenantId) {
149151
public Uni<Mutiny.StatelessSession> openStatelessSession() {
150152
SessionCreationOptions options = options();
151153
return uni( () -> connection( options.getTenantIdentifier() ) )
152-
.chain( reactiveConnection -> create( reactiveConnection, () -> new ReactiveStatelessSessionImpl( delegate, options, reactiveConnection ) ) )
154+
.chain( reactiveConnection -> create( reactiveConnection,
155+
() -> new ReactiveStatelessSessionImpl( delegate, options, reactiveConnection ) ) )
153156
.map( s -> new MutinyStatelessSessionImpl(s, this) );
154157
}
155158

156159
@Override
157160
public Uni<Mutiny.StatelessSession> openStatelessSession(String tenantId) {
158161
return uni( () -> connection( tenantId ) )
159-
.chain( reactiveConnection -> create( reactiveConnection, () -> new ReactiveStatelessSessionImpl( delegate, options( tenantId ), reactiveConnection ) ) )
162+
.chain( reactiveConnection -> create( reactiveConnection,
163+
() -> new ReactiveStatelessSessionImpl( delegate, options( tenantId ), reactiveConnection ) ) )
160164
.map( s -> new MutinyStatelessSessionImpl( s, this ) );
161165
}
162166

@@ -201,7 +205,7 @@ public <T> Uni<T> withSession(Function<Mutiny.Session, Uni<T>> work) {
201205
public <T> Uni<T> withSession(String tenantId, Function<Mutiny.Session, Uni<T>> work) {
202206
Objects.requireNonNull( tenantId, "parameter 'tenantId' is required" );
203207
Objects.requireNonNull( work, "parameter 'work' is required" );
204-
Context.Key<Mutiny.Session> key = new MultitenantKey( contextKeyForSession, tenantId );
208+
Context.Key<Mutiny.Session> key = new MultitenantKey<>( contextKeyForSession, tenantId );
205209
Mutiny.Session current = context.get(key);
206210
if ( current!=null && current.isOpen() ) {
207211
LOG.debugf( "Reusing existing open Mutiny.Session which was found in the current Vert.x context for current tenant '%s'", tenantId );

hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/SqlClientConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public CompletionStage<Void> commitTransaction() {
293293
@Override
294294
public CompletionStage<Void> rollbackTransaction() {
295295
return transaction.rollback()
296-
.onSuccess( v -> LOG.tracef( "Transaction rollbacked: %s", transaction ) )
296+
.onSuccess( v -> LOG.tracef( "Transaction rolled back: %s", transaction ) )
297297
.toCompletionStage()
298298
.whenComplete( (v, x) -> transaction = null );
299299
}

hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/SqlClientPool.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55
*/
66
package org.hibernate.reactive.pool.impl;
77

8-
import java.lang.invoke.MethodHandles;
8+
import java.util.List;
99
import java.util.concurrent.CompletionStage;
1010

1111
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
12-
import org.hibernate.reactive.logging.impl.Log;
13-
import org.hibernate.reactive.logging.impl.LoggerFactory;
1412
import org.hibernate.reactive.pool.ReactiveConnection;
1513
import org.hibernate.reactive.pool.ReactiveConnectionPool;
1614

1715
import io.vertx.sqlclient.Pool;
1816
import io.vertx.sqlclient.SqlConnection;
1917

20-
2118
/**
2219
* A pool of reactive connections backed by a supplier of
2320
* Vert.x {@link Pool} instances.
@@ -37,8 +34,6 @@
3734
*/
3835
public abstract class SqlClientPool implements ReactiveConnectionPool {
3936

40-
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
41-
4237
/**
4338
* @return the underlying Vert.x {@link Pool} for the current context.
4439
*/
@@ -60,7 +55,7 @@ public abstract class SqlClientPool implements ReactiveConnectionPool {
6055
*
6156
* @throws UnsupportedOperationException if multitenancy is not supported
6257
*
63-
* @see #getConnection(String)
58+
* @see ReactiveConnectionPool#getConnection(String)
6459
*/
6560
protected Pool getTenantPool(String tenantId) {
6661
throw new UnsupportedOperationException("multitenancy not supported by built-in SqlClientPool");

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveSessionFactoryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* {@link Mutiny.SessionFactory}.
3434
*/
3535
public class ReactiveSessionFactoryImpl extends SessionFactoryImpl {
36+
3637
public ReactiveSessionFactoryImpl(MetadataImplementor metadata, SessionFactoryOptions options) {
3738
// We aren't using lambdas or method reference because of a bug in the JVM:
3839
// https://bugs.openjdk.java.net/browse/JDK-8161588
@@ -41,7 +42,7 @@ public ReactiveSessionFactoryImpl(MetadataImplementor metadata, SessionFactoryOp
4142
@Override
4243
public HQLQueryPlan createQueryPlan(String queryString, boolean shallow, Map<String, Filter> enabledFilters,
4344
SessionFactoryImplementor factory) {
44-
return new ReactiveHQLQueryPlan(queryString, shallow, enabledFilters, factory);
45+
return new ReactiveHQLQueryPlan<>(queryString, shallow, enabledFilters, factory);
4546
}
4647
}); //TODO: pass ReactiveNativeHQLQueryPlan::new
4748

hibernate-reactive-core/src/main/java/org/hibernate/reactive/session/impl/ReactiveStatelessSessionImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class ReactiveStatelessSessionImpl extends StatelessSessionImpl
8585

8686
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
8787

88-
private ReactiveConnection reactiveConnection;
88+
private final ReactiveConnection reactiveConnection;
8989

9090
private final ReactiveStatelessSession batchingHelperSession;
9191

@@ -115,7 +115,6 @@ private ReactiveStatelessSessionImpl(
115115
reactiveConnection = batchSize == null || batchSize < 2
116116
? connection
117117
: new BatchingConnection( connection, batchSize );
118-
reactiveConnection = connection;
119118
batchingHelperSession = this;
120119
}
121120

@@ -844,7 +843,7 @@ public <T> RootGraphImplementor<T> getEntityGraph(Class<T> entity, String name)
844843

845844
@Override
846845
public <T> RootGraphImplementor<T> createEntityGraph(Class<T> entity) {
847-
return new RootGraphImpl<T>( null, getFactory().getMetamodel().entity( entity ), getFactory() );
846+
return new RootGraphImpl<>( null, getFactory().getMetamodel().entity( entity ), getFactory() );
848847
}
849848

850849
private RootGraphImplementor<?> createEntityGraph(String graphName) {

hibernate-reactive-core/src/main/java/org/hibernate/reactive/stage/impl/StageSessionFactoryImpl.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,29 +78,33 @@ public Context getContext() {
7878
public CompletionStage<Stage.Session> openSession() {
7979
SessionCreationOptions options = options();
8080
return connection( options.getTenantIdentifier() )
81-
.thenCompose( connection -> create( connection, () -> new ReactiveSessionImpl( delegate, options, connection ) ) )
81+
.thenCompose( connection -> create( connection,
82+
() -> new ReactiveSessionImpl( delegate, options, connection ) ) )
8283
.thenApply( StageSessionImpl::new );
8384
}
8485

8586
@Override
8687
public CompletionStage<Stage.Session> openSession(String tenantId) {
8788
return connection( tenantId )
88-
.thenCompose( connection -> create( connection, () -> new ReactiveSessionImpl( delegate, options( tenantId ), connection ) ) )
89+
.thenCompose( connection -> create( connection,
90+
() -> new ReactiveSessionImpl( delegate, options( tenantId ), connection ) ) )
8991
.thenApply( StageSessionImpl::new );
9092
}
9193

9294
@Override
9395
public CompletionStage<Stage.StatelessSession> openStatelessSession() {
9496
SessionCreationOptions options = options();
9597
return connection( options.getTenantIdentifier() )
96-
.thenCompose( connection -> create( connection, () -> new ReactiveStatelessSessionImpl( delegate, options, connection ) ) )
98+
.thenCompose( connection -> create( connection,
99+
() -> new ReactiveStatelessSessionImpl( delegate, options, connection ) ) )
97100
.thenApply( StageStatelessSessionImpl::new );
98101
}
99102

100103
@Override
101104
public CompletionStage<Stage.StatelessSession> openStatelessSession(String tenantId) {
102105
return connection( tenantId )
103-
.thenCompose( connection -> create( connection, () -> new ReactiveStatelessSessionImpl( delegate, options( tenantId ), connection ) ) )
106+
.thenCompose( connection -> create( connection,
107+
() -> new ReactiveStatelessSessionImpl( delegate, options( tenantId ), connection ) ) )
104108
.thenApply( StageStatelessSessionImpl::new );
105109
}
106110

0 commit comments

Comments
 (0)