public class ChainedTransactionManagerPostProcessor extends java.lang.Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.core.Ordered
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 .
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
DATA_SOURCES_PREFIX |
|
static java.lang.String |
DATA_SOURCES_SETTING |
|
static java.lang.String |
DATA_SOURCE_SETTING |
Constructor and description |
---|
ChainedTransactionManagerPostProcessor
(Config config) |
ChainedTransactionManagerPostProcessor
(Config config, java.lang.String whitelistPattern, java.lang.String blacklistPattern) |
ChainedTransactionManagerPostProcessor
() |
Type Params | Return 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) |
|
public java.lang.String |
getBeanNameBlacklistPattern() |
|
public java.lang.String |
getBeanNameInternalBlacklistPattern() |
|
public java.lang.String |
getBeanNameWhitelistPattern() |
|
public int |
getOrder() |
|
protected static java.lang.String[] |
getTransactionManagerBeanNames(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
|
protected boolean |
hasJtaOrChainedTransactionManager(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
|
protected boolean |
isNotTransactional(java.lang.String suffix) |
|
protected boolean |
isValidTransactionManagerBeanDefinition(java.lang.String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition) |
|
public void |
postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
|
public void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
|
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) |
|
public void |
setBeanNameBlacklistPattern(java.lang.String beanNameBlacklistPattern) |
|
public void |
setBeanNameInternalBlacklistPattern(java.lang.String beanNameInternalBlacklistPattern) |
|
public void |
setBeanNameWhitelistPattern(java.lang.String beanNameWhitelistPattern) |
|
public void |
setConfig(Config config) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |