120120
121121import static java .lang .Boolean .TRUE ;
122122import static org .hibernate .boot .model .naming .Identifier .toIdentifier ;
123+ import static org .hibernate .internal .SessionLogging .SESSION_LOGGER ;
123124import static org .hibernate .internal .util .StringHelper .isEmpty ;
124125import static org .hibernate .query .sqm .internal .SqmUtil .verifyIsSelectStatement ;
125126
139140 * @author Steve Ebersole
140141 */
141142public abstract class AbstractSharedSessionContract implements SharedSessionContractImplementor {
142- private static final CoreMessageLogger LOG = CoreLogging .messageLogger ( SessionImpl .class );
143143
144144 private transient SessionFactoryImpl factory ;
145145 private transient SessionFactoryOptions factoryOptions ;
@@ -282,13 +282,12 @@ protected final void setUpMultitenancy(SessionFactoryImplementor factory, LoadQu
282282 }
283283
284284 private void logInconsistentOptions (SharedSessionCreationOptions sharedOptions ) {
285+ // TODO: these should probable be exceptions!
285286 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 ();
288288 }
289289 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 ();
292291 }
293292 }
294293
@@ -357,15 +356,17 @@ void afterTransactionBeginEvents() {
357356 }
358357
359358 void beforeTransactionCompletionEvents () {
359+ SESSION_LOGGER .beforeTransactionCompletion ();
360360 try {
361361 getInterceptor ().beforeTransactionCompletion ( getTransactionIfAccessible () );
362362 }
363363 catch (Throwable t ) {
364- LOG .exceptionInBeforeTransactionCompletionInterceptor ( t );
364+ SESSION_LOGGER .exceptionInBeforeTransactionCompletionInterceptor ( t );
365365 }
366366 }
367367
368368 void afterTransactionCompletionEvents (boolean successful ) {
369+ SESSION_LOGGER .afterTransactionCompletion ( successful , false );
369370 getEventListenerManager ().transactionCompletion (successful );
370371
371372 final var statistics = getFactory ().getStatistics ();
@@ -377,7 +378,7 @@ void afterTransactionCompletionEvents(boolean successful) {
377378 getInterceptor ().afterTransactionCompletion ( getTransactionIfAccessible () );
378379 }
379380 catch (Throwable t ) {
380- LOG .exceptionInAfterTransactionCompletionInterceptor ( t );
381+ SESSION_LOGGER .exceptionInAfterTransactionCompletionInterceptor ( t );
381382 }
382383 }
383384
@@ -1686,9 +1687,7 @@ public SessionAssociationMarkers getSessionAssociationMarkers() {
16861687
16871688 @ Serial
16881689 private void writeObject (ObjectOutputStream oos ) throws IOException {
1689- if ( LOG .isTraceEnabled () ) {
1690- LOG .trace ( "Serializing " + getClass ().getSimpleName () + " [" );
1691- }
1690+ SESSION_LOGGER .serializingSession ( getSessionIdentifier () );
16921691
16931692
16941693 if ( !jdbcCoordinator .isReadyForSerialization () ) {
@@ -1721,13 +1720,10 @@ private void writeObject(ObjectOutputStream oos) throws IOException {
17211720
17221721 @ Serial
17231722 private void readObject (ObjectInputStream ois ) throws IOException , ClassNotFoundException , SQLException {
1724- if ( LOG .isTraceEnabled () ) {
1725- LOG .trace ( "Deserializing " + getClass ().getSimpleName () );
1726- }
1727-
17281723 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17291724 // Step 1 :: read back non-transient state...
17301725 ois .defaultReadObject ();
1726+ SESSION_LOGGER .deserializingSession ( getSessionIdentifier () );
17311727
17321728 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17331729 // Step 2 :: read back transient state...
0 commit comments