11
11
import jakarta .transaction .TransactionManager ;
12
12
import jakarta .transaction .UserTransaction ;
13
13
14
- import org .hibernate .cfg .AvailableSettings ;
15
14
import org .hibernate .engine .jndi .spi .JndiService ;
16
15
import org .hibernate .engine .transaction .internal .jta .JtaStatusHelper ;
17
16
import org .hibernate .engine .transaction .jta .platform .spi .JtaPlatform ;
18
17
import org .hibernate .engine .transaction .jta .platform .spi .JtaPlatformException ;
19
- import org .hibernate .internal .util .config .ConfigurationHelper ;
20
18
import org .hibernate .service .ServiceRegistry ;
21
19
import org .hibernate .service .spi .Configurable ;
22
20
import org .hibernate .service .spi .ServiceRegistryAwareService ;
23
21
import org .hibernate .service .spi .ServiceRegistryImplementor ;
24
22
23
+ import static org .hibernate .cfg .TransactionSettings .JTA_CACHE_TM ;
24
+ import static org .hibernate .cfg .TransactionSettings .JTA_CACHE_UT ;
25
+ import static org .hibernate .internal .util .config .ConfigurationHelper .getBoolean ;
26
+
25
27
/**
26
28
* @author Steve Ebersole
27
29
*/
@@ -43,7 +45,7 @@ private final class TransactionManagerBasedSynchronizationStrategy implements Jt
43
45
@ Override
44
46
public void registerSynchronization (Synchronization synchronization ) {
45
47
try {
46
- AbstractJtaPlatform . this . getTransactionManager ().getTransaction ().registerSynchronization ( synchronization );
48
+ getTransactionManager ().getTransaction ().registerSynchronization ( synchronization );
47
49
}
48
50
catch (Exception e ) {
49
51
throw new JtaPlatformException ( "Could not access JTA Transaction to register synchronization" , e );
@@ -52,7 +54,7 @@ public void registerSynchronization(Synchronization synchronization) {
52
54
53
55
@ Override
54
56
public boolean canRegisterSynchronization () {
55
- return JtaStatusHelper .isActive ( AbstractJtaPlatform . this . getTransactionManager () );
57
+ return JtaStatusHelper .isActive ( getTransactionManager () );
56
58
}
57
59
}
58
60
@@ -68,16 +70,8 @@ protected JndiService jndiService() {
68
70
protected abstract UserTransaction locateUserTransaction ();
69
71
70
72
public void configure (Map <String , Object > configValues ) {
71
- cacheTransactionManager = ConfigurationHelper .getBoolean (
72
- AvailableSettings .JTA_CACHE_TM ,
73
- configValues ,
74
- canCacheTransactionManagerByDefault ()
75
- );
76
- cacheUserTransaction = ConfigurationHelper .getBoolean (
77
- AvailableSettings .JTA_CACHE_UT ,
78
- configValues ,
79
- canCacheUserTransactionByDefault ()
80
- );
73
+ cacheTransactionManager = getBoolean ( JTA_CACHE_TM , configValues , canCacheTransactionManagerByDefault () );
74
+ cacheUserTransaction = getBoolean ( JTA_CACHE_UT , configValues , canCacheUserTransactionByDefault () );
81
75
}
82
76
83
77
protected boolean canCacheTransactionManagerByDefault () {
@@ -126,7 +120,9 @@ public UserTransaction retrieveUserTransaction() {
126
120
}
127
121
return userTransaction ;
128
122
}
129
- return locateUserTransaction ();
123
+ else {
124
+ return locateUserTransaction ();
125
+ }
130
126
}
131
127
132
128
@ Override
0 commit comments