org.springframework.transaction.support.AbstractPlatformTransactionManager Java Examples

The following examples show how to use org.springframework.transaction.support.AbstractPlatformTransactionManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MicroServiceTemplateSupport.java    From nh-micro with Apache License 2.0 5 votes vote down vote up
public void checkRollbackAndThrow() throws Exception{
	PlatformTransactionManager  transactionManager=MicroTranManagerHolder.getTransactionManager(dbName);
	boolean flag=((AbstractPlatformTransactionManager) transactionManager).isFailEarlyOnGlobalRollbackOnly();
	if(flag){
		throw new RuntimeException("dbTranNestRollbackAndThrow");
	}

}
 
Example #2
Source File: ProducerOnlyTransactionTests.java    From spring-cloud-stream-binder-kafka with Apache License 2.0 5 votes vote down vote up
@Bean
public PlatformTransactionManager transactionManager(BinderFactory binders) {
	try {
		ProducerFactory<byte[], byte[]> pf = ((KafkaMessageChannelBinder) binders.getBinder(null,
				MessageChannel.class)).getTransactionalProducerFactory();
		KafkaTransactionManager<byte[], byte[]> tm = new KafkaTransactionManager<>(pf);
		tm.setTransactionSynchronization(AbstractPlatformTransactionManager.SYNCHRONIZATION_ON_ACTUAL_TRANSACTION);
		return tm;
	}
	catch (BeanCreationException e) { // needed to avoid other tests in this package failing when there is no binder
		return null;
	}
}
 
Example #3
Source File: MicroServiceTemplateSupport.java    From nh-micro with Apache License 2.0 5 votes vote down vote up
public void checkRollbackAndThrow() throws Exception{
	PlatformTransactionManager  transactionManager=MicroTranManagerHolder.getTransactionManager(dbName);
	boolean flag=((AbstractPlatformTransactionManager) transactionManager).isFailEarlyOnGlobalRollbackOnly();
	if(flag){
		throw new RuntimeException("dbTranNestRollbackAndThrow");
	}

}
 
Example #4
Source File: SearchPlatformTransactionManager.java    From jkes with Apache License 2.0 4 votes vote down vote up
public SearchPlatformTransactionManager(AbstractPlatformTransactionManager platformTransactionManager, EventSupport eventSupport) {
    this.platformTransactionManager = platformTransactionManager;
    this.eventSupport = eventSupport;
}