热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

bitronix.tm.BitronixTransactionManager.rollback()方法的使用及代码示例

本文整理了Java中bitronix.tm.BitronixTransactionManager.rollback()方法的一些代码示例,展示了Bitron

本文整理了Java中bitronix.tm.BitronixTransactionManager.rollback()方法的一些代码示例,展示了BitronixTransactionManager.rollback()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitronixTransactionManager.rollback()方法的具体详情如下:
包路径:bitronix.tm.BitronixTransactionManager
类名称:BitronixTransactionManager
方法名:rollback

BitronixTransactionManager.rollback介绍

暂无

代码示例

代码示例来源:origin: ehcache/ehcache3

public static void testXmlConfiguration() throws Exception {
BitronixTransactionManager transactiOnManager= getTransactionManager();
try (CacheManager cacheManager = newCacheManager(
new XmlConfiguration(TestMethods.class.getResource("ehcache-xa-osgi.xml"), TestMethods.class.getClassLoader())
)) {
cacheManager.init();
Cache xaCache = cacheManager.getCache("xaCache", Long.class, String.class);
transactionManager.begin();
try {
xaCache.put(1L, "one");
} catch (Throwable t) {
transactionManager.rollback();
}
transactionManager.commit();
}
transactionManager.shutdown();
}
}

代码示例来源:origin: ehcache/ehcache3

public static void testProgrammaticConfiguration() throws Exception {
BitronixTransactionManager transactiOnManager= getTransactionManager();
try (CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
.withClassLoader(TestMethods.class.getClassLoader())
.using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class))
.withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, heap(10))
.add(new XAStoreConfiguration("xaCache")).build()).build(true)) {
Cache xaCache = cacheManager.getCache("xaCache", Long.class, String.class);
transactionManager.begin();
try {
xaCache.put(1L, "one");
} catch (Throwable t) {
transactionManager.rollback();
}
transactionManager.commit();
}
transactionManager.shutdown();
}

代码示例来源:origin: org.jbpm/droolsjbpm-knowledge-services

public void rollback() throws IllegalStateException, SecurityException, SystemException {

try {
btm.rollback();
} finally {
getSynchronizations().afterTransactionCompletion(false);
}
}

代码示例来源:origin: bitronix/btm

public void testSuspendResume() throws Exception {
log.info("test starts");
btm.begin();
log.info("tx begun");
Transaction tx = btm.suspend();
log.info("tx suspended");
btm.resume(tx);
log.info("tx resumed");
btm.rollback();
log.info("test over");
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

public void testSuspendResume() throws Exception {
log.info("test starts");
btm.begin();
log.info("tx begun");
Transaction tx = btm.suspend();
log.info("tx suspended");
btm.resume(tx);
log.info("tx resumed");
btm.rollback();
log.info("test over");
}

代码示例来源:origin: bitronix/btm

protected void tearDown() throws Exception {
if (btm.getStatus() != Status.STATUS_NO_TRANSACTION)
btm.rollback();
btm.shutdown();
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

protected void tearDown() throws Exception {
if (btm.getStatus() != Status.STATUS_NO_TRANSACTION)
btm.rollback();
btm.shutdown();
}

代码示例来源:origin: bitronix/btm

@Override
protected void tearDown() throws Exception {
try {
if (log.isDebugEnabled()) { log.debug("*** tearDown rollback"); }
TransactionManagerServices.getTransactionManager().rollback();
} catch (Exception ex) {
// ignore
}
poolingDataSource1.close();
poolingDataSource2.close();
TransactionManagerServices.getTransactionManager().shutdown();
}

代码示例来源:origin: bitronix/btm

@Override
protected void tearDown() throws Exception {
try {
if (log.isDebugEnabled()) { log.debug("*** tearDown rollback"); }
TransactionManagerServices.getTransactionManager().rollback();
} catch (Exception ex) {
// ignore
}
poolingConnectionFactory1.close();
poolingConnectionFactory2.close();
TransactionManagerServices.getTransactionManager().shutdown();
}
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

@Override
protected void tearDown() throws Exception {
try {
if (log.isDebugEnabled()) { log.debug("*** tearDown rollback"); }
TransactionManagerServices.getTransactionManager().rollback();
} catch (Exception ex) {
// ignore
}
poolingDataSource1.close();
poolingDataSource2.close();
TransactionManagerServices.getTransactionManager().shutdown();
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

@Override
protected void tearDown() throws Exception {
try {
if (log.isDebugEnabled()) { log.debug("*** tearDown rollback"); }
TransactionManagerServices.getTransactionManager().rollback();
} catch (Exception ex) {
// ignore
}
poolingConnectionFactory1.close();
poolingConnectionFactory2.close();
TransactionManagerServices.getTransactionManager().shutdown();
}
}

代码示例来源:origin: bitronix/btm

public void testEagerEnding() throws Exception {
BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
try {
tm.rollback();
fail("TM allowed rollback with no TX started");
} catch (IllegalStateException ex) {
assertEquals("no transaction started on this thread", ex.getMessage());
}
try {
tm.commit();
fail("TM allowed commit with no TX started");
} catch (IllegalStateException ex) {
assertEquals("no transaction started on this thread", ex.getMessage());
}
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

public void testEagerEnding() throws Exception {
BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
try {
tm.rollback();
fail("TM allowed rollback with no TX started");
} catch (IllegalStateException ex) {
assertEquals("no transaction started on this thread", ex.getMessage());
}
try {
tm.commit();
fail("TM allowed commit with no TX started");
} catch (IllegalStateException ex) {
assertEquals("no transaction started on this thread", ex.getMessage());
}
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

tm.rollback();
if (log.isDebugEnabled()) { log.debug("*** TX is done"); }

代码示例来源:origin: bitronix/btm

public void testTransactionManagerGetTransaction() throws Exception {
assertNull(btm.getTransaction());
btm.begin();
assertNotNull(btm.getTransaction());
btm.commit();
assertNull(btm.getTransaction());
btm.begin();
assertNotNull(btm.getTransaction());
btm.rollback();
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

public void testTransactionManagerGetTransaction() throws Exception {
assertNull(btm.getTransaction());
btm.begin();
assertNotNull(btm.getTransaction());
btm.commit();
assertNull(btm.getTransaction());
btm.begin();
assertNotNull(btm.getTransaction());
btm.rollback();
}

代码示例来源:origin: bitronix/btm

public void testSkipInFlightCommit() throws Exception {
BitronixTransactionManager btm = TransactionManagerServices.getTransactionManager();
Uid uid0 = UidGenerator.generateUid();
Xid xid0 = new MockXid(0, uid0.getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid0);
Set names = new HashSet();
names.add(pds.getUniqueName());
journal.log(Status.STATUS_COMMITTING, new Uid(xid0.getGlobalTransactionId()), names);
assertNull(btm.getCurrentTransaction());
Thread.sleep(30); // let the clock run a bit so that in-flight TX is a bit older than the journaled one
btm.begin();
Xid xid1 = new MockXid(1, UidGenerator.generateUid().getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid1);
names = new HashSet();
names.add(pds.getUniqueName());
journal.log(Status.STATUS_COMMITTING, new Uid(xid1.getGlobalTransactionId()), names);
TransactionManagerServices.getRecoverer().run();
btm.rollback();
assertEquals(1, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
btm.shutdown();
TransactionManagerServices.getJournal().open();
TransactionManagerServices.getRecoverer().run();
assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

public void testSkipInFlightCommit() throws Exception {
BitronixTransactionManager btm = TransactionManagerServices.getTransactionManager();
Uid uid0 = UidGenerator.generateUid();
Xid xid0 = new MockXid(0, uid0.getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid0);
Set names = new HashSet();
names.add(pds.getUniqueName());
journal.log(Status.STATUS_COMMITTING, new Uid(xid0.getGlobalTransactionId()), names);
assertNull(btm.getCurrentTransaction());
Thread.sleep(30); // let the clock run a bit so that in-flight TX is a bit older than the journaled one
btm.begin();
Xid xid1 = new MockXid(1, UidGenerator.generateUid().getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid1);
names = new HashSet();
names.add(pds.getUniqueName());
journal.log(Status.STATUS_COMMITTING, new Uid(xid1.getGlobalTransactionId()), names);
TransactionManagerServices.getRecoverer().run();
btm.rollback();
assertEquals(1, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
btm.shutdown();
TransactionManagerServices.getJournal().open();
TransactionManagerServices.getRecoverer().run();
assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
}

代码示例来源:origin: bitronix/btm

public void testSkipInFlightRollback() throws Exception {
BitronixTransactionManager btm = TransactionManagerServices.getTransactionManager();
Uid uid0 = UidGenerator.generateUid();
Xid xid0 = new MockXid(0, uid0.getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid0);
assertNull(btm.getCurrentTransaction());
Thread.sleep(30); // let the clock run a bit so that in-flight TX is a bit older than the journaled one
btm.begin();
Xid xid1 = new MockXid(1, UidGenerator.generateUid().getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid1);
TransactionManagerServices.getRecoverer().run();
btm.rollback();
assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount());
assertEquals(1, TransactionManagerServices.getRecoverer().getRolledbackCount());
assertEquals(1, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
btm.shutdown();
TransactionManagerServices.getJournal().open();
TransactionManagerServices.getRecoverer().run();
assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount());
assertEquals(1, TransactionManagerServices.getRecoverer().getRolledbackCount());
assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

public void testSkipInFlightRollback() throws Exception {
BitronixTransactionManager btm = TransactionManagerServices.getTransactionManager();
Uid uid0 = UidGenerator.generateUid();
Xid xid0 = new MockXid(0, uid0.getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid0);
assertNull(btm.getCurrentTransaction());
Thread.sleep(30); // let the clock run a bit so that in-flight TX is a bit older than the journaled one
btm.begin();
Xid xid1 = new MockXid(1, UidGenerator.generateUid().getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid1);
TransactionManagerServices.getRecoverer().run();
btm.rollback();
assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount());
assertEquals(1, TransactionManagerServices.getRecoverer().getRolledbackCount());
assertEquals(1, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
btm.shutdown();
TransactionManagerServices.getJournal().open();
TransactionManagerServices.getRecoverer().run();
assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount());
assertEquals(1, TransactionManagerServices.getRecoverer().getRolledbackCount());
assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
}

推荐阅读
  • 本文介绍了如何在Azure应用服务实例上获取.NetCore 3.0+的支持。作者分享了自己在将代码升级为使用.NET Core 3.0时遇到的问题,并提供了解决方法。文章还介绍了在部署过程中使用Kudu构建的方法,并指出了可能出现的错误。此外,还介绍了开发者应用服务计划和免费产品应用服务计划在不同地区的运行情况。最后,文章指出了当前的.NET SDK不支持目标为.NET Core 3.0的问题,并提供了解决方案。 ... [详细]
  • 本文介绍了C#中生成随机数的三种方法,并分析了其中存在的问题。首先介绍了使用Random类生成随机数的默认方法,但在高并发情况下可能会出现重复的情况。接着通过循环生成了一系列随机数,进一步突显了这个问题。文章指出,随机数生成在任何编程语言中都是必备的功能,但Random类生成的随机数并不可靠。最后,提出了需要寻找其他可靠的随机数生成方法的建议。 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 标题: ... [详细]
  • Ihavethefollowingonhtml我在html上有以下内容<html><head><scriptsrc..3003_Tes ... [详细]
  • 预备知识可参考我整理的博客Windows编程之线程:https:www.cnblogs.comZhuSenlinp16662075.htmlWindows编程之线程同步:https ... [详细]
  • Spring学习(4):Spring管理对象之间的关联关系
    本文是关于Spring学习的第四篇文章,讲述了Spring框架中管理对象之间的关联关系。文章介绍了MessageService类和MessagePrinter类的实现,并解释了它们之间的关联关系。通过学习本文,读者可以了解Spring框架中对象之间的关联关系的概念和实现方式。 ... [详细]
  • Android系统源码分析Zygote和SystemServer启动过程详解
    本文详细解析了Android系统源码中Zygote和SystemServer的启动过程。首先介绍了系统framework层启动的内容,帮助理解四大组件的启动和管理过程。接着介绍了AMS、PMS等系统服务的作用和调用方式。然后详细分析了Zygote的启动过程,解释了Zygote在Android启动过程中的决定作用。最后通过时序图展示了整个过程。 ... [详细]
  • 纠正网上的错误:自定义一个类叫java.lang.System/String的方法
    本文纠正了网上关于自定义一个类叫java.lang.System/String的错误答案,并详细解释了为什么这种方法是错误的。作者指出,虽然双亲委托机制确实可以阻止自定义的System类被加载,但通过自定义一个特殊的类加载器,可以绕过双亲委托机制,达到自定义System类的目的。作者呼吁读者对网上的内容持怀疑态度,并带着问题来阅读文章。 ... [详细]
  • 本文介绍了解决java开源项目apache commons email简单使用报错的方法,包括使用正确的JAR包和正确的代码配置,以及相关参数的设置。详细介绍了如何使用apache commons email发送邮件。 ... [详细]
  • JVM:33 如何查看JVM的Full GC日志
    1.示例代码packagecom.webcode;publicclassDemo4{publicstaticvoidmain(String[]args){byte[]arr ... [详细]
author-avatar
晓晓鱼美人
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有