120
120
121
121
import static java .lang .Boolean .TRUE ;
122
122
import static org .hibernate .boot .model .naming .Identifier .toIdentifier ;
123
+ import static org .hibernate .internal .SessionLogging .SESSION_LOGGER ;
123
124
import static org .hibernate .internal .util .StringHelper .isEmpty ;
124
125
import static org .hibernate .query .sqm .internal .SqmUtil .verifyIsSelectStatement ;
125
126
139
140
* @author Steve Ebersole
140
141
*/
141
142
public abstract class AbstractSharedSessionContract implements SharedSessionContractImplementor {
142
- private static final CoreMessageLogger LOG = CoreLogging .messageLogger ( SessionImpl .class );
143
143
144
144
private transient SessionFactoryImpl factory ;
145
145
private transient SessionFactoryOptions factoryOptions ;
@@ -282,13 +282,12 @@ protected final void setUpMultitenancy(SessionFactoryImplementor factory, LoadQu
282
282
}
283
283
284
284
private void logInconsistentOptions (SharedSessionCreationOptions sharedOptions ) {
285
+ // TODO: these should probable be exceptions!
285
286
if ( sharedOptions .shouldAutoJoinTransactions () ) {
286
- LOG .debug ( "Session creation specified 'autoJoinTransactions', which is invalid in conjunction " +
287
- "with sharing JDBC connection between sessions; ignoring" );
287
+ SESSION_LOGGER .invalidAutoJoinTransactionsWithSharedConnection ();
288
288
}
289
289
if ( sharedOptions .getPhysicalConnectionHandlingMode () != connectionHandlingMode ) {
290
- LOG .debug ( "Session creation specified 'PhysicalConnectionHandlingMode' which is invalid in conjunction " +
291
- "with sharing JDBC connection between sessions; ignoring" );
290
+ SESSION_LOGGER .invalidPhysicalConnectionHandlingModeWithSharedConnection ();
292
291
}
293
292
}
294
293
@@ -357,15 +356,17 @@ void afterTransactionBeginEvents() {
357
356
}
358
357
359
358
void beforeTransactionCompletionEvents () {
359
+ SESSION_LOGGER .beforeTransactionCompletion ();
360
360
try {
361
361
getInterceptor ().beforeTransactionCompletion ( getTransactionIfAccessible () );
362
362
}
363
363
catch (Throwable t ) {
364
- LOG .exceptionInBeforeTransactionCompletionInterceptor ( t );
364
+ SESSION_LOGGER .exceptionInBeforeTransactionCompletionInterceptor ( t );
365
365
}
366
366
}
367
367
368
368
void afterTransactionCompletionEvents (boolean successful ) {
369
+ SESSION_LOGGER .afterTransactionCompletion ( successful , false );
369
370
getEventListenerManager ().transactionCompletion (successful );
370
371
371
372
final var statistics = getFactory ().getStatistics ();
@@ -377,7 +378,7 @@ void afterTransactionCompletionEvents(boolean successful) {
377
378
getInterceptor ().afterTransactionCompletion ( getTransactionIfAccessible () );
378
379
}
379
380
catch (Throwable t ) {
380
- LOG .exceptionInAfterTransactionCompletionInterceptor ( t );
381
+ SESSION_LOGGER .exceptionInAfterTransactionCompletionInterceptor ( t );
381
382
}
382
383
}
383
384
@@ -1686,9 +1687,7 @@ public SessionAssociationMarkers getSessionAssociationMarkers() {
1686
1687
1687
1688
@ Serial
1688
1689
private void writeObject (ObjectOutputStream oos ) throws IOException {
1689
- if ( LOG .isTraceEnabled () ) {
1690
- LOG .trace ( "Serializing " + getClass ().getSimpleName () + " [" );
1691
- }
1690
+ SESSION_LOGGER .serializingSession ( getSessionIdentifier () );
1692
1691
1693
1692
1694
1693
if ( !jdbcCoordinator .isReadyForSerialization () ) {
@@ -1721,13 +1720,10 @@ private void writeObject(ObjectOutputStream oos) throws IOException {
1721
1720
1722
1721
@ Serial
1723
1722
private void readObject (ObjectInputStream ois ) throws IOException , ClassNotFoundException , SQLException {
1724
- if ( LOG .isTraceEnabled () ) {
1725
- LOG .trace ( "Deserializing " + getClass ().getSimpleName () );
1726
- }
1727
-
1728
1723
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1729
1724
// Step 1 :: read back non-transient state...
1730
1725
ois .defaultReadObject ();
1726
+ SESSION_LOGGER .deserializingSession ( getSessionIdentifier () );
1731
1727
1732
1728
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1733
1729
// Step 2 :: read back transient state...
0 commit comments