当前位置: 首页>>代码示例>>Java>>正文


Java BitronixTransactionManager.shutdown方法代码示例

本文整理汇总了Java中bitronix.tm.BitronixTransactionManager.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java BitronixTransactionManager.shutdown方法的具体用法?Java BitronixTransactionManager.shutdown怎么用?Java BitronixTransactionManager.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bitronix.tm.BitronixTransactionManager的用法示例。


在下文中一共展示了BitronixTransactionManager.shutdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testXAWithStatefulSerializer

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXAWithStatefulSerializer() throws Exception {
  BitronixTransactionManager manager = TransactionManagerServices.getTransactionManager();
  try (CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
        .using(new LookupTransactionManagerProviderConfiguration(
          BitronixTransactionManagerLookup.class))
        .withCache("xaCache",
          CacheConfigurationBuilder
            .newCacheConfigurationBuilder(Long.class, Person.class,
              ResourcePoolsBuilder.heap(5))
            .withExpiry(ExpiryPolicyBuilder.noExpiration()).add(new XAStoreConfiguration("xaCache"))
            .build())
        .build(true)) {

    Cache<Long, Person> cache = cacheManager.getCache("xaCache", Long.class, Person.class);
    manager.begin();
    cache.put(1L, new Person("James", 42));
    manager.commit();

    manager.begin();
    assertNotNull(cache.get(1L));
    manager.commit();
  } finally {
    manager.shutdown();
  }
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:27,代码来源:StatefulSerializerTest.java

示例2: testClusteredCacheWithXA

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testClusteredCacheWithXA() throws Exception {
  TransactionManagerServices.getConfiguration().setJournal("null");

  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager();

  PersistentCacheManager persistentCacheManager = null;
  try {
    CacheManagerBuilder.newCacheManagerBuilder()
        .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class))
        .with(ClusteringServiceConfigurationBuilder.cluster(URI.create("terracotta://localhost/my-application")).autoCreate())
        .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class,
            ResourcePoolsBuilder.newResourcePoolsBuilder()
                .with(ClusteredResourcePoolBuilder.clusteredDedicated("primary-server-resource", 8, MemoryUnit.MB))
            )
                .add(new XAStoreConfiguration("xaCache"))
                .build()
        )
        .build(true);
  } catch (StateTransitionException e) {
    assertThat(e.getCause().getCause().getMessage(), is("Unsupported resource type : interface org.ehcache.clustered.client.config.DedicatedClusteredResourcePool"));
  }

  transactionManager.shutdown();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:27,代码来源:UnSupportedCombinationsWIthClusteredCacheTest.java

示例3: stop

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Override
public void stop(BundleContext context) throws Exception {
	BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
       tm.shutdown();

       tmRegistration.unregister();
       utRegistration.unregister();

       for (ServiceRegistration reg : dsRegistrations.values()) {
           reg.unregister();
       }
       dsRegistrations.clear();

       Configuration conf = TransactionManagerServices.getConfiguration();
       log.info(String.format("Stopped JTA for server ID '%s'.", conf.getServerId()));
}
 
开发者ID:bitronix,项目名称:btm,代码行数:17,代码来源:Activator.java

示例4: testPrepares

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testPrepares() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(60);
    tm.begin();

    Connection connection = poolingDataSource2.getConnection();

    for (int i = 0; i < 1000; i++) {
        PreparedStatement prepareStatement = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
        assertFalse(prepareStatement.isClosed());
        prepareStatement.close();
        assertTrue(prepareStatement.isClosed());
    }

    connection.close();

    tm.commit();
    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:21,代码来源:JdbcProxyTest.java

示例5: testCachedPrepared

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testCachedPrepared() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(60);
    tm.begin();

    Connection connection = poolingDataSource1.getConnection();

    PreparedStatement prepareStatement1 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
    PreparedStatement prepareStatement2 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");

    Assert.assertSame(prepareStatement1.unwrap(PreparedStatement.class), prepareStatement2.unwrap(PreparedStatement.class));

    prepareStatement2.close();

    prepareStatement2 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
    Assert.assertSame(prepareStatement1.unwrap(PreparedStatement.class), prepareStatement2.unwrap(PreparedStatement.class));

    prepareStatement1.close();
    prepareStatement2.close();

    connection.close();
    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:25,代码来源:JdbcProxyTest.java

示例6: testCachedStatementsCanBeReused

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testCachedStatementsCanBeReused() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(60);
    tm.begin();
    try {
        Connection connection = poolingDataSource1.getConnection();
        try {
            PreparedStatement prepareStatement1 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
            assertFalse(prepareStatement1.isClosed());

            prepareStatement1.close();
            assertTrue(prepareStatement1.isClosed());

            PreparedStatement prepareStatement2 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
            assertFalse(prepareStatement2.isClosed());
        } finally {
            connection.close();
        }
    } finally {
        tm.shutdown();
    }
}
 
开发者ID:bitronix,项目名称:btm,代码行数:24,代码来源:JdbcProxyTest.java

示例7: testUnCachedPrepared

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testUnCachedPrepared() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(60);
    tm.begin();

    Connection connection = poolingDataSource2.getConnection();

    PreparedStatement prepareStatement1 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
    PreparedStatement prepareStatement2 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");

    Assert.assertNotSame(prepareStatement1.unwrap(PreparedStatement.class), prepareStatement2.unwrap(PreparedStatement.class));

    prepareStatement2.close();

    prepareStatement2 = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
    Assert.assertNotSame(prepareStatement1.unwrap(PreparedStatement.class), prepareStatement2.unwrap(PreparedStatement.class));

    prepareStatement1.close();
    prepareStatement2.close();

    connection.close();
    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:25,代码来源:JdbcProxyTest.java

示例8: testSimpleXACache

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testSimpleXACache() throws Exception {
  // tag::testSimpleXACache[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <3>
                                                          ResourcePoolsBuilder.heap(10)) // <4>
          .add(new XAStoreConfiguration("xaCache")) // <5>
          .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = cacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <6>
  {
    xaCache.put(1L, "one"); // <7>
  }
  transactionManager.commit(); // <8>

  cacheManager.close();
  transactionManager.shutdown();
  // end::testSimpleXACache[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:28,代码来源:XAGettingStarted.java

示例9: testNonTransactionalAccess

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testNonTransactionalAccess() throws Exception {
  // tag::testNonTransactionalAccess[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <3>
                                                          ResourcePoolsBuilder.heap(10)) // <4>
          .add(new XAStoreConfiguration("xaCache")) // <5>
          .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = cacheManager.getCache("xaCache", Long.class, String.class);

  try {
    xaCache.get(1L); // <6>
    fail("expected XACacheException");
  } catch (XACacheException e) {
    // expected
  }

  cacheManager.close();
  transactionManager.shutdown();
  // end::testNonTransactionalAccess[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:29,代码来源:XAGettingStarted.java

示例10: testXACacheWithWriteThrough

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testXACacheWithWriteThrough() throws Exception {
  // tag::testXACacheWithWriteThrough[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  Class<CacheLoaderWriter<?, ?>> klazz = (Class<CacheLoaderWriter<?, ?>>) (Class) (SampleLoaderWriter.class);

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <3>
                                                          ResourcePoolsBuilder.heap(10)) // <4>
              .add(new XAStoreConfiguration("xaCache")) // <5>
              .add(new DefaultCacheLoaderWriterConfiguration(klazz, singletonMap(1L, "eins"))) // <6>
              .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = cacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <7>
  {
    assertThat(xaCache.get(1L), equalTo("eins")); // <8>
    xaCache.put(1L, "one"); // <9>
  }
  transactionManager.commit(); // <10>

  cacheManager.close();
  transactionManager.shutdown();
  // end::testXACacheWithWriteThrough[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:33,代码来源:XAGettingStarted.java

示例11: testXACacheWithThreeTiers

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXACacheWithThreeTiers() throws Exception {
  // tag::testXACacheWithThreeTiers[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  PersistentCacheManager persistentCacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .with(CacheManagerBuilder.persistence(new File(getStoragePath(), "testXACacheWithThreeTiers"))) // <3>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <4>
              ResourcePoolsBuilder.newResourcePoolsBuilder() // <5>
                      .heap(10, EntryUnit.ENTRIES)
                      .offheap(10, MemoryUnit.MB)
                      .disk(20, MemoryUnit.MB, true)
              )
              .add(new XAStoreConfiguration("xaCache")) // <6>
              .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = persistentCacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <7>
  {
    xaCache.put(1L, "one"); // <8>
  }
  transactionManager.commit(); // <9>

  persistentCacheManager.close();
  transactionManager.shutdown();
  // end::testXACacheWithThreeTiers[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:33,代码来源:XAGettingStarted.java

示例12: testXACacheWithXMLConfig

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXACacheWithXMLConfig() throws Exception {
  // tag::testXACacheWithXMLConfig[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  URL myUrl = this.getClass().getResource("/docs/configs/xa-getting-started.xml"); // <2>
  Configuration xmlConfig = new XmlConfiguration(myUrl); // <3>
  CacheManager myCacheManager = CacheManagerBuilder.newCacheManager(xmlConfig); // <4>
  myCacheManager.init();

  myCacheManager.close();
  transactionManager.shutdown();
  // end::testXACacheWithXMLConfig[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:16,代码来源:XAGettingStarted.java

示例13: testSimpleConfig

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testSimpleConfig() throws Exception {
  TransactionManagerServices.getConfiguration().setJournal("null").setServerId("XmlConfigTest");
  BitronixTransactionManager transactionManager = TransactionManagerServices.getTransactionManager();

  final URL myUrl = this.getClass().getResource("/configs/simple-xa.xml");
  Configuration xmlConfig = new XmlConfiguration(myUrl);
  CacheManager myCacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);
  myCacheManager.init();

  myCacheManager.close();
  transactionManager.shutdown();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:14,代码来源:XmlConfigTest.java

示例14: testSetters

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testSetters() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(30);
    tm.begin();

    Connection connection = poolingDataSource1.getConnection();

    long start = System.nanoTime();
    PreparedStatement stmt = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
    Date date = new Date(0);
    for (int i = 0; i < 50000; i++) {
        stmt.setString(1, "foo");
        stmt.setInt(2, 999);
        stmt.setDate(3, date);
        stmt.setFloat(4, 9.99f);
        stmt.clearParameters();
    }
    long totalTime = System.nanoTime() - start;

    stmt.executeQuery();

    connection.close();

    tm.commit();
    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:28,代码来源:JdbcProxyTest.java

示例15: testNonEnlistingMethodInTxContext

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
public void testNonEnlistingMethodInTxContext() throws Exception {
    Thread.currentThread().setName("testNonEnlistingMethodInTxContext");
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();

    tm.begin();

    Connection c = poolingDataSource1.getConnection();
    assertTrue(c.getAutoCommit());
    c.close();

    tm.commit();

    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:15,代码来源:NewJdbcProperUsageMockTest.java


注:本文中的bitronix.tm.BitronixTransactionManager.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。