diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java index 184b95886b..9a5b05ec4c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/AbstractJtaPlatform.java @@ -48,6 +48,8 @@ public abstract class AbstractJtaPlatform private boolean cacheUserTransaction; private ServiceRegistryImplementor serviceRegistry; + private final JtaSynchronizationStrategy tmSynchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); + @Override public void injectServices(ServiceRegistryImplementor serviceRegistry) { this.serviceRegistry = serviceRegistry; @@ -116,7 +118,9 @@ public abstract class AbstractJtaPlatform return transaction; } - protected abstract JtaSynchronizationStrategy getSynchronizationStrategy(); + protected JtaSynchronizationStrategy getSynchronizationStrategy() { + return tmSynchronizationStrategy; + } @Override public void registerSynchronization(Synchronization synchronization) { diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BitronixJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BitronixJtaPlatform.java index 948cfc1e86..50cb08e78a 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BitronixJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BitronixJtaPlatform.java @@ -35,13 +35,6 @@ import org.hibernate.service.jta.platform.spi.JtaPlatformException; public class BitronixJtaPlatform extends AbstractJtaPlatform { private static final String TM_CLASS_NAME = "bitronix.tm.TransactionManagerServices"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } - @Override protected TransactionManager locateTransactionManager() { try { diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BorlandEnterpriseServerJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BorlandEnterpriseServerJtaPlatform.java index 4a6c0770e7..9144f8e113 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BorlandEnterpriseServerJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/BorlandEnterpriseServerJtaPlatform.java @@ -33,8 +33,6 @@ public class BorlandEnterpriseServerJtaPlatform extends AbstractJtaPlatform { protected static final String TM_NAME = "java:pm/TransactionManager"; protected static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -44,9 +42,4 @@ public class BorlandEnterpriseServerJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerJtaPlatform.java similarity index 71% rename from hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerPlatform.java rename to hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerJtaPlatform.java index c3202f8d23..8f4c973bef 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossAppServerJtaPlatform.java @@ -24,7 +24,6 @@ package org.hibernate.service.jta.platform.internal; import javax.transaction.TransactionManager; -import javax.transaction.TransactionSynchronizationRegistry; import javax.transaction.UserTransaction; /** @@ -32,12 +31,10 @@ import javax.transaction.UserTransaction; * * @author Steve Ebersole */ -public class JBossAppServerPlatform extends AbstractJtaPlatform implements SynchronizationRegistryAccess { +public class JBossAppServerJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:/TransactionManager"; public static final String UT_NAME = "UserTransaction"; - public static final String REG_NAME = "java:comp/TransactionSynchronizationRegistry"; - private final JtaSynchronizationStrategy synchronizationStrategy = new SynchronizationRegistryBasedSynchronizationStrategy( this ); @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,14 +44,4 @@ public class JBossAppServerPlatform extends AbstractJtaPlatform implements Synch protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } - - @Override - public TransactionSynchronizationRegistry getSynchronizationRegistry() { - return (TransactionSynchronizationRegistry) jndiService().locate( REG_NAME ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossStandAloneJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossStandAloneJtaPlatform.java index 4b5c0dc865..891c8439fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossStandAloneJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JBossStandAloneJtaPlatform.java @@ -40,8 +40,6 @@ public class JBossStandAloneJtaPlatform extends AbstractJtaPlatform { private static final String JBOSS_TM_CLASS_NAME = "com.arjuna.ats.jta.TransactionManager"; private static final String JBOSS_UT_CLASS_NAME = "com.arjuna.ats.jta.UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { try { @@ -67,9 +65,4 @@ public class JBossStandAloneJtaPlatform extends AbstractJtaPlatform { throw new JtaPlatformException( "Could not obtain JBoss Transactions user transaction instance", e ); } } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOTMJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOTMJtaPlatform.java index 6360d3fb82..80305a636b 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOTMJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOTMJtaPlatform.java @@ -37,8 +37,6 @@ public class JOTMJtaPlatform extends AbstractJtaPlatform { public static final String TM_CLASS_NAME = "org.objectweb.jotm.Current"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { try { @@ -55,9 +53,4 @@ public class JOTMJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOnASJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOnASJtaPlatform.java index 05f66abd0a..521c35cbd7 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOnASJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JOnASJtaPlatform.java @@ -37,8 +37,6 @@ public class JOnASJtaPlatform extends AbstractJtaPlatform { public static final String UT_NAME = "java:comp/UserTransaction"; private static final String TM_CLASS_NAME = "org.objectweb.jonas_tm.Current"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { try { @@ -55,9 +53,4 @@ public class JOnASJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JRun4JtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JRun4JtaPlatform.java index fde0d6eecd..2242bcdbb3 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JRun4JtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JRun4JtaPlatform.java @@ -36,8 +36,6 @@ public class JRun4JtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:/TransactionManager"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,9 +45,4 @@ public class JRun4JtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java index 815f9064f8..51d3494ab9 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/JtaPlatformInitiator.java @@ -122,7 +122,7 @@ public class JtaPlatformInitiator implements BasicServiceInitiator } if ( "org.hibernate.transaction.JBossTransactionManagerLookup".equals( tmlImplName ) ) { - return new JBossAppServerPlatform(); + return new JBossAppServerJtaPlatform(); } if ( "org.hibernate.transaction.JBossTSStandaloneTransactionManagerLookup".equals( tmlImplName ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OC4JJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OC4JJtaPlatform.java index 4112ebdf4d..c21c9c6019 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OC4JJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OC4JJtaPlatform.java @@ -36,8 +36,6 @@ public class OC4JJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:comp/pm/TransactionManager"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,9 +45,4 @@ public class OC4JJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OrionJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OrionJtaPlatform.java index 44b862c6c4..40028e9539 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OrionJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/OrionJtaPlatform.java @@ -36,8 +36,6 @@ public class OrionJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:comp/UserTransaction"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,9 +45,4 @@ public class OrionJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/ResinJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/ResinJtaPlatform.java index 6b44cc305e..b2ad76130e 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/ResinJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/ResinJtaPlatform.java @@ -36,8 +36,6 @@ public class ResinJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:comp/TransactionManager"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,9 +45,4 @@ public class ResinJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/SunOneJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/SunOneJtaPlatform.java index 0213b9e52a..bd962698ec 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/SunOneJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/SunOneJtaPlatform.java @@ -38,8 +38,6 @@ public class SunOneJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "java:appserver/TransactionManager"; public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -49,9 +47,4 @@ public class SunOneJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/TransactionManagerLookupBridge.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/TransactionManagerLookupBridge.java index 5d90ea8368..237e952e32 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/TransactionManagerLookupBridge.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/TransactionManagerLookupBridge.java @@ -38,8 +38,6 @@ public class TransactionManagerLookupBridge extends AbstractJtaPlatform { private final TransactionManagerLookup lookup; private final Properties jndiProperties; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - public TransactionManagerLookupBridge(TransactionManagerLookup lookup, Properties jndiProperties) { this.lookup = lookup; this.jndiProperties = jndiProperties; @@ -55,11 +53,6 @@ public class TransactionManagerLookupBridge extends AbstractJtaPlatform { return (UserTransaction) serviceRegistry().getService( JndiService.class ).locate( lookup.getUserTransactionName() ); } - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } - @Override public Object getTransactionIdentifier(Transaction transaction) { return lookup.getTransactionIdentifier( transaction ); diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereExtendedJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereExtendedJtaPlatform.java index 8cbc82bb23..4a2ea29145 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereExtendedJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereExtendedJtaPlatform.java @@ -57,8 +57,6 @@ import org.hibernate.HibernateException; public class WebSphereExtendedJtaPlatform extends AbstractJtaPlatform { public static final String UT_NAME = "java:comp/UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected boolean canCacheTransactionManager() { return true; @@ -81,11 +79,6 @@ public class WebSphereExtendedJtaPlatform extends AbstractJtaPlatform { return Integer.valueOf( transaction.hashCode() ); } - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } - public class TransactionManagerAdapter implements TransactionManager { private final Class synchronizationCallbackClass; private final Method registerSynchronizationMethod; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereJtaPlatform.java index ef980425a4..76bd5923a7 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WebSphereJtaPlatform.java @@ -38,14 +38,11 @@ import org.jboss.logging.Logger; * @author Steve Ebersole */ public class WebSphereJtaPlatform extends AbstractJtaPlatform { - private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, WebSphereJtaPlatform.class.getName()); public static final String VERSION_5_UT_NAME = "java:comp/UserTransaction"; public static final String VERSION_4_UT_NAME = "jta/usertransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - private final Class transactionManagerAccessClass; private final int webSphereVersion; @@ -96,9 +93,4 @@ public class WebSphereJtaPlatform extends AbstractJtaPlatform { final String utName = webSphereVersion == 5 ? VERSION_5_UT_NAME : VERSION_4_UT_NAME; return (UserTransaction) jndiService().locate( utName ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WeblogicJtaPlatform.java b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WeblogicJtaPlatform.java index 1cbe3a221f..26bc3a69f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WeblogicJtaPlatform.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jta/platform/internal/WeblogicJtaPlatform.java @@ -36,8 +36,6 @@ public class WeblogicJtaPlatform extends AbstractJtaPlatform { public static final String TM_NAME = "javax.transaction.TransactionManager"; public static final String UT_NAME = "javax.transaction.UserTransaction"; - private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this ); - @Override protected TransactionManager locateTransactionManager() { return (TransactionManager) jndiService().locate( TM_NAME ); @@ -47,9 +45,4 @@ public class WeblogicJtaPlatform extends AbstractJtaPlatform { protected UserTransaction locateUserTransaction() { return (UserTransaction) jndiService().locate( UT_NAME ); } - - @Override - protected JtaSynchronizationStrategy getSynchronizationStrategy() { - return synchronizationStrategy; - } }