12
12
import jakarta .transaction .Status ;
13
13
14
14
import org .hibernate .resource .transaction .spi .IsolationDelegate ;
15
- import org .hibernate .internal .CoreMessageLogger ;
16
15
import org .hibernate .jpa .spi .JpaCompliance ;
17
16
import org .hibernate .resource .transaction .backend .jdbc .spi .JdbcResourceTransaction ;
18
17
import org .hibernate .resource .transaction .backend .jdbc .spi .JdbcResourceTransactionAccess ;
25
24
import org .hibernate .resource .transaction .spi .TransactionStatus ;
26
25
27
26
import static java .util .Collections .emptyList ;
28
- import static org .hibernate .internal .CoreLogging .messageLogger ;
27
+ import static org .hibernate .engine .jdbc .JdbcLogging .JDBC_LOGGER ;
28
+ import static org .hibernate .engine .jdbc .JdbcLogging .JDBC_MESSAGE_LOGGER ;
29
29
30
30
/**
31
31
* An implementation of {@link TransactionCoordinator} based on managing a
36
36
* @see JdbcResourceTransaction
37
37
*/
38
38
public class JdbcResourceLocalTransactionCoordinatorImpl implements TransactionCoordinator {
39
- private static final CoreMessageLogger log = messageLogger ( JdbcResourceLocalTransactionCoordinatorImpl .class );
40
39
41
40
private final TransactionCoordinatorBuilder transactionCoordinatorBuilder ;
42
41
private final JdbcResourceTransactionAccess jdbcResourceTransactionAccess ;
@@ -92,7 +91,7 @@ public TransactionDriver getTransactionDriverControl() {
92
91
@ Override
93
92
public void explicitJoin () {
94
93
// nothing to do here, but log a warning
95
- log .callingJoinTransactionOnNonJtaEntityManager ();
94
+ JDBC_MESSAGE_LOGGER .callingJoinTransactionOnNonJtaEntityManager ();
96
95
}
97
96
98
97
@ Override
@@ -151,7 +150,7 @@ private void afterBeginCallback() {
151
150
// report entering into a "transactional context"
152
151
transactionCoordinatorOwner .startTransactionBoundary ();
153
152
154
- log .trace ( "Notifying resource-local transaction observers after begin" );
153
+ JDBC_LOGGER .trace ( "Notifying resource-local transaction observers after begin" );
155
154
156
155
// trigger the Transaction-API-only after-begin callback
157
156
transactionCoordinatorOwner .afterTransactionBegin ();
@@ -163,7 +162,7 @@ private void afterBeginCallback() {
163
162
}
164
163
165
164
private void beforeCompletionCallback () {
166
- log .trace ( "Notifying resource-local transaction observers before completion" );
165
+ JDBC_LOGGER .trace ( "Notifying resource-local transaction observers before completion" );
167
166
try {
168
167
transactionCoordinatorOwner .beforeTransactionCompletion ();
169
168
synchronizationRegistry .notifySynchronizationsBeforeTransactionCompletion ();
@@ -181,7 +180,7 @@ private void beforeCompletionCallback() {
181
180
}
182
181
183
182
private void afterCompletionCallback (boolean successful ) {
184
- log .trace ( "Notifying resource-local transaction observers after completion" );
183
+ JDBC_LOGGER .trace ( "Notifying resource-local transaction observers after completion" );
185
184
final int statusToSend = successful ? Status .STATUS_COMMITTED : Status .STATUS_ROLLEDBACK ;
186
185
synchronizationRegistry .notifySynchronizationsAfterTransactionCompletion ( statusToSend );
187
186
transactionCoordinatorOwner .afterTransactionCompletion ( successful , false );
@@ -231,7 +230,7 @@ public void begin() {
231
230
232
231
protected void errorIfInvalid () {
233
232
if ( invalid ) {
234
- throw new IllegalStateException ( "Physical- transaction delegate is no longer valid" );
233
+ throw new IllegalStateException ( "Physical transaction delegate is no longer valid" );
235
234
}
236
235
}
237
236
@@ -263,14 +262,14 @@ private void commitNoRollbackOnly() {
263
262
}
264
263
catch (RuntimeException e2 ) {
265
264
e .addSuppressed ( e2 );
266
- log .debug ( "Encountered failure rolling back failed commit" , e2 );
265
+ JDBC_LOGGER .debug ( "Encountered failure rolling back failed commit" , e2 );
267
266
}
268
267
throw e ;
269
268
}
270
269
}
271
270
272
271
private void commitRollbackOnly () {
273
- log .trace ( "On commit, transaction was marked for rollback only, rolling back" );
272
+ JDBC_LOGGER .trace ( "On commit, transaction was marked for rollback only, rolling back" );
274
273
rollback ();
275
274
if ( jpaCompliance .isJpaTransactionComplianceEnabled () ) {
276
275
throw new RollbackException ( "Transaction was marked for rollback only" );
@@ -301,8 +300,8 @@ public TransactionStatus getStatus() {
301
300
@ Override
302
301
public void markRollbackOnly () {
303
302
if ( getStatus () != TransactionStatus .ROLLED_BACK ) {
304
- if ( log .isTraceEnabled () ) {
305
- log .trace ( "JDBC transaction marked for rollback only (exception provided for stack trace)" ,
303
+ if ( JDBC_LOGGER .isTraceEnabled () ) {
304
+ JDBC_LOGGER .trace ( "JDBC transaction marked for rollback only (exception provided for stack trace)" ,
306
305
new Exception ( "exception just for purpose of providing stack trace" ) );
307
306
}
308
307
rollbackOnly = true ;
0 commit comments