Groovy Documentation

org.codehaus.groovy.grails.transaction
[Java] Class ChainedTransactionManagerPostProcessor

java.lang.Object
  org.codehaus.groovy.grails.transaction.ChainedTransactionManagerPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.core.Ordered

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 .

Authors:
Lari Hotari
Since:
2.3.6


Constructor Summary
ChainedTransactionManagerPostProcessor(groovy.util.ConfigObject config)

ChainedTransactionManagerPostProcessor(groovy.util.ConfigObject config, java.lang.String whitelistPattern, java.lang.String blacklistPattern)

ChainedTransactionManagerPostProcessor()

 
Method Summary
protected void addChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

protected int countChainableTransactionManagerBeans(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

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 dsConfigs, java.lang.String suffix)

protected boolean isValidTransactionManagerBeanName(java.lang.String beanName)

void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)

void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

protected java.util.Map readDataSourceConfig()

protected void registerAdditionalTransactionManagers(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

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 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()
 

Constructor Detail

ChainedTransactionManagerPostProcessor

public ChainedTransactionManagerPostProcessor(groovy.util.ConfigObject config)


ChainedTransactionManagerPostProcessor

public ChainedTransactionManagerPostProcessor(groovy.util.ConfigObject config, java.lang.String whitelistPattern, java.lang.String blacklistPattern)


ChainedTransactionManagerPostProcessor

public ChainedTransactionManagerPostProcessor()


 
Method Detail

addChainedTransactionManager

protected void addChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)


countChainableTransactionManagerBeans

protected int countChainableTransactionManagerBeans(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)


getBeanNameBlacklistPattern

public java.lang.String getBeanNameBlacklistPattern()


getBeanNameInternalBlacklistPattern

public java.lang.String getBeanNameInternalBlacklistPattern()


getBeanNameWhitelistPattern

public java.lang.String getBeanNameWhitelistPattern()


getOrder

@java.lang.Overridereturn Ordered.HIGHEST_PRECEDENCE;
public int getOrder()


hasJtaOrChainedTransactionManager

protected boolean hasJtaOrChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)


isNotTransactional

protected boolean isNotTransactional(java.util.Map dsConfigs, java.lang.String suffix)


isValidTransactionManagerBeanName

protected boolean isValidTransactionManagerBeanName(java.lang.String beanName)


postProcessBeanDefinitionRegistry

@java.lang.Override
public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)


postProcessBeanFactory

@java.lang.Override
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)


readDataSourceConfig

@java.lang.SuppressWarnings({ "rawtypes", "unchecked" })
protected java.util.Map readDataSourceConfig()


registerAdditionalTransactionManagers

protected void registerAdditionalTransactionManagers(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)


resolveDataSourceSuffix

protected java.lang.String resolveDataSourceSuffix(java.lang.String transactionManagerBeanName)


resolveTransactionManagerClass

protected java.lang.Class resolveTransactionManagerClass(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)


setBeanNameBlacklistPattern

public void setBeanNameBlacklistPattern(java.lang.String beanNameBlacklistPattern)


setBeanNameInternalBlacklistPattern

public void setBeanNameInternalBlacklistPattern(java.lang.String beanNameInternalBlacklistPattern)


setBeanNameWhitelistPattern

public void setBeanNameWhitelistPattern(java.lang.String beanNameWhitelistPattern)


setConfig

public void setConfig(groovy.util.ConfigObject config)


 

Groovy Documentation