17
17
import org .hibernate .internal .SessionCreationOptions ;
18
18
import org .hibernate .internal .SessionFactoryImpl ;
19
19
import org .hibernate .reactive .common .spi .Implementor ;
20
+ import org .hibernate .reactive .common .spi .MutinyImplementor ;
20
21
import org .hibernate .reactive .context .Context ;
21
22
import org .hibernate .reactive .context .impl .BaseKey ;
22
23
import org .hibernate .reactive .context .impl .MultitenantKey ;
37
38
* <p>
38
39
* Obtained by calling {@link org.hibernate.SessionFactory#unwrap(Class)}.
39
40
*/
40
- public class MutinySessionFactoryImpl implements Mutiny .SessionFactory , Implementor {
41
+ public class MutinySessionFactoryImpl implements Mutiny .SessionFactory , Implementor , MutinyImplementor {
41
42
42
43
private final SessionFactoryImpl delegate ;
43
44
private final ReactiveConnectionPool connectionPool ;
@@ -81,7 +82,7 @@ public Context getContext() {
81
82
}
82
83
83
84
@ Override
84
- public Mutiny .Session openSession () {
85
+ public Mutiny .Session newSession () {
85
86
SessionCreationOptions options = options ();
86
87
return new MutinySessionImpl (
87
88
new ReactiveSessionImpl ( delegate , options , proxyConnection ( options .getTenantIdentifier () ) ),
@@ -90,7 +91,7 @@ public Mutiny.Session openSession() {
90
91
}
91
92
92
93
@ Override
93
- public Mutiny .Session openSession (String tenantId ) {
94
+ public Mutiny .Session newSession (String tenantId ) {
94
95
Objects .requireNonNull ( tenantId , "parameter 'tenantId' is required" );
95
96
return new MutinySessionImpl (
96
97
new ReactiveSessionImpl ( delegate , options ( tenantId ), proxyConnection ( tenantId ) ),
@@ -99,15 +100,15 @@ public Mutiny.Session openSession(String tenantId) {
99
100
}
100
101
101
102
@ Override
102
- public Uni <Mutiny .Session > newSession () {
103
+ public Uni <Mutiny .Session > openSession () {
103
104
SessionCreationOptions options = options ();
104
105
return uni ( () -> connection ( options .getTenantIdentifier () ) )
105
106
.chain ( reactiveConnection -> create ( reactiveConnection , () -> new ReactiveSessionImpl ( delegate , options , reactiveConnection ) ) )
106
107
.map ( s -> new MutinySessionImpl (s , this ) );
107
108
}
108
109
109
110
@ Override
110
- public Uni <Mutiny .Session > newSession (String tenantId ) {
111
+ public Uni <Mutiny .Session > openSession (String tenantId ) {
111
112
return uni ( () -> connection ( tenantId ) )
112
113
.chain ( reactiveConnection -> create ( reactiveConnection , () -> new ReactiveSessionImpl ( delegate , options ( tenantId ), reactiveConnection ) ) )
113
114
.map ( s -> new MutinySessionImpl (s , this ) );
@@ -122,7 +123,7 @@ private <S> Uni<S> create(ReactiveConnection connection, Supplier<S> supplier) {
122
123
}
123
124
124
125
@ Override
125
- public Mutiny .StatelessSession openStatelessSession () {
126
+ public Mutiny .StatelessSession newStatelessSession () {
126
127
SessionCreationOptions options = options ();
127
128
return new MutinyStatelessSessionImpl (
128
129
new ReactiveStatelessSessionImpl ( delegate , options , proxyConnection ( options .getTenantIdentifier () ) ),
@@ -131,23 +132,23 @@ public Mutiny.StatelessSession openStatelessSession() {
131
132
}
132
133
133
134
@ Override
134
- public Mutiny .StatelessSession openStatelessSession (String tenantId ) {
135
+ public Mutiny .StatelessSession newStatelessSession (String tenantId ) {
135
136
return new MutinyStatelessSessionImpl (
136
137
new ReactiveStatelessSessionImpl ( delegate , options ( tenantId ), proxyConnection ( tenantId ) ),
137
138
this
138
139
);
139
140
}
140
141
141
142
@ Override
142
- public Uni <Mutiny .StatelessSession > newStatelessSession () {
143
+ public Uni <Mutiny .StatelessSession > openStatelessSession () {
143
144
SessionCreationOptions options = options ();
144
145
return uni ( () -> connection ( options .getTenantIdentifier () ) )
145
146
.chain ( reactiveConnection -> create ( reactiveConnection , () -> new ReactiveStatelessSessionImpl ( delegate , options , reactiveConnection ) ) )
146
147
.map ( s -> new MutinyStatelessSessionImpl (s , this ) );
147
148
}
148
149
149
150
@ Override
150
- public Uni <Mutiny .StatelessSession > newStatelessSession (String tenantId ) {
151
+ public Uni <Mutiny .StatelessSession > openStatelessSession (String tenantId ) {
151
152
return uni ( () -> connection ( tenantId ) )
152
153
.chain ( reactiveConnection -> create ( reactiveConnection , () -> new ReactiveStatelessSessionImpl ( delegate , options ( tenantId ), reactiveConnection ) ) )
153
154
.map ( s -> new MutinyStatelessSessionImpl ( s , this ) );
@@ -183,7 +184,7 @@ public <T> Uni<T> withSession(Function<Mutiny.Session, Uni<T>> work) {
183
184
if ( current != null && current .isOpen () ) {
184
185
return work .apply ( current );
185
186
}
186
- return withSession ( newSession (), work , contextKeyForSession );
187
+ return withSession ( openSession (), work , contextKeyForSession );
187
188
}
188
189
189
190
@ Override
@@ -195,7 +196,7 @@ public <T> Uni<T> withSession(String tenantId, Function<Mutiny.Session, Uni<T>>
195
196
if ( current !=null && current .isOpen () ) {
196
197
return work .apply ( current );
197
198
}
198
- return withSession ( newSession ( tenantId ), work , key );
199
+ return withSession ( openSession ( tenantId ), work , key );
199
200
}
200
201
201
202
@ Override
@@ -205,7 +206,7 @@ public <T> Uni<T> withStatelessSession(Function<Mutiny.StatelessSession, Uni<T>>
205
206
if ( current != null && current .isOpen () ) {
206
207
return work .apply ( current );
207
208
}
208
- return withSession ( newStatelessSession (), work , contextKeyForStatelessSession );
209
+ return withSession ( openStatelessSession (), work , contextKeyForStatelessSession );
209
210
}
210
211
211
212
@ Override
@@ -217,7 +218,7 @@ public <T> Uni<T> withStatelessSession(String tenantId, Function<Mutiny.Stateles
217
218
if ( current != null && current .isOpen () ) {
218
219
return work .apply ( current );
219
220
}
220
- return withSession ( newStatelessSession ( tenantId ), work , key );
221
+ return withSession ( openStatelessSession ( tenantId ), work , key );
221
222
}
222
223
223
224
private <S extends Mutiny .Closeable , T > Uni <T > withSession (
0 commit comments