public class ChainedTransactionManagerPostProcessor extends java.lang.Object
A org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor for using the "Best Effort 1 Phase Commit" (BE1PC) in Grails applications when there are multiple data sources. When the context contains multiple transactionManager beans, the bean with the name "transactionManager" will be renamed to "$primaryTransactionManager" and a new ChainedTransactionManager bean will be added with the name "transactionManager". All transactionManager beans will be registered in the ChainedTransactionManager bean. The post processor checks if the previous transactionManager bean is an instance of org.springframework.transaction.jta.JtaTransactionManager. In that case it will not do anything since it's assumed that JTA/XA is handling transactions spanning multiple datasources. For performance reasons an additional dataSource can be marked as non-transactional by adding a property 'transactional = false' in it's dataSource configuration. This will leave the dataSource out of the transactions initiated by Grails transactions. This is the default behaviour in Grails versions before Grails 2.3.6 .
Constructor and description |
---|
ChainedTransactionManagerPostProcessor
(groovy.util.ConfigObject config) |
ChainedTransactionManagerPostProcessor
(groovy.util.ConfigObject config, java.lang.String whitelistPattern, java.lang.String blacklistPattern) |
ChainedTransactionManagerPostProcessor
() |
Type | Name and description |
---|---|
protected org.springframework.beans.factory.config.BeanDefinition |
addChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
protected int |
countChainableTransactionManagerBeans(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
protected org.springframework.beans.factory.support.ManagedList<org.springframework.beans.factory.config.RuntimeBeanReference> |
createTransactionManagerBeanReferences(org.springframework.beans.factory.config.BeanDefinition chainedTransactionManagerBeanDefinition) |
java.lang.String |
getBeanNameBlacklistPattern() |
java.lang.String |
getBeanNameInternalBlacklistPattern() |
java.lang.String |
getBeanNameWhitelistPattern() |
int |
getOrder() |
protected boolean |
hasJtaOrChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
protected boolean |
isNotTransactional(java.util.Map<java.lang.String, groovy.util.ConfigObject> dsConfigs, java.lang.String suffix) |
protected boolean |
isValidTransactionManagerBeanDefinition(java.lang.String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) |
void |
postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
protected java.util.Map<java.lang.String, groovy.util.ConfigObject> |
readDataSourceConfig() |
protected void |
registerAdditionalTransactionManagers(org.springframework.beans.factory.support.BeanDefinitionRegistry registry, org.springframework.beans.factory.config.BeanDefinition chainedTransactionManagerBeanDefinition, org.springframework.beans.factory.support.ManagedList<org.springframework.beans.factory.config.RuntimeBeanReference> transactionManagerRefs) |
protected java.lang.String |
resolveDataSourceSuffix(java.lang.String transactionManagerBeanName) |
protected java.lang.Class<?> |
resolveTransactionManagerClass(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
void |
setBeanNameBlacklistPattern(java.lang.String beanNameBlacklistPattern) |
void |
setBeanNameInternalBlacklistPattern(java.lang.String beanNameInternalBlacklistPattern) |
void |
setBeanNameWhitelistPattern(java.lang.String beanNameWhitelistPattern) |
void |
setConfig(groovy.util.ConfigObject config) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |