com.arjuna.ats.jta.TransactionManager类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(157)

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

TransactionManager介绍

暂无

代码示例

代码示例来源:origin: kiegroup/drools

final TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
final TransactionSynchronizationRegistry tsr =
    jtaPropertyManager.getJTAEnvironmentBean().getTransactionSynchronizationRegistry();
sanitizedPoolingProperties.setProperty("username", driverProperties.getProperty("user"));
sanitizedPoolingProperties.setProperty("password", driverProperties.getProperty("password"));

代码示例来源:origin: org.jboss.jbossts/jbossjta

protected final boolean transactionRunning() throws SQLException
{
  try
  {
    if (com.arjuna.ats.jta.TransactionManager.transactionManager()
        .getTransaction() != null)
    {
      return true;
    }
    else
    {
      return false;
    }
  }
  catch (Exception e)
  {
    SQLException sqlException = new SQLException(e.toString());
    sqlException.initCause(e);
    throw sqlException;
  }
}

代码示例来源:origin: org.jbpm/jbpm-test

@Deprecated
public static StatefulKnowledgeSession loadStatefulKnowledgeSession(KieBase kbase, int sessionId) {
  Properties properties = getProperties();
  String persistenceEnabled = properties.getProperty("persistence.enabled", "false");
  RuntimeEnvironmentBuilder builder = null;
  if ("true".equals(persistenceEnabled)) {
    String dialect = properties.getProperty("persistence.persistenceunit.dialect", "org.hibernate.dialect.H2Dialect");
    Map<String, String> map = new HashMap<String, String>();
    map.put("hibernate.dialect", dialect);
    EntityManagerFactory emf = Persistence.createEntityManagerFactory(properties.getProperty("persistence.persistenceunit.name", "org.jbpm.persistence.jpa"), map);
    
    
    builder = RuntimeEnvironmentBuilder.Factory.get()
        .newDefaultBuilder()
      .entityManagerFactory(emf)                
      .addEnvironmentEntry(EnvironmentName.TRANSACTION_MANAGER, com.arjuna.ats.jta.TransactionManager.transactionManager());
  } else {            
    builder = RuntimeEnvironmentBuilder.Factory.get()
        .newDefaultInMemoryBuilder();
  }
  builder.knowledgeBase(kbase);
  RuntimeManager manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(builder.get());
  return (StatefulKnowledgeSession) manager.getRuntimeEngine(EmptyContext.get()).getKieSession();
}

代码示例来源:origin: org.mule.modules/mule-module-jbossts

props.setProperty(PROPERTY_ENVIRONMENT_OBJECTSTORE_DIR, objectStoreDir);
props.setProperty(PROPERTY_OBJECTSTORE_DIR, objectStoreDir);
props.setProperty(PROPERTY_USER_DIR, muleInternalDir);
tm = com.arjuna.ats.jta.TransactionManager.transactionManager();

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();

    transactionManager.begin();

    Transaction currentTrans = transactionManager.getTransaction();

    TestResource res1, res2;
    currentTrans.enlistResource( res1 = new TestResource() );
    currentTrans.enlistResource( res2 = new TestResource() );

    currentTrans.delistResource( res2, XAResource.TMSUCCESS );
    currentTrans.delistResource( res1, XAResource.TMSUCCESS );

    transactionManager.commit();
  }
}

代码示例来源:origin: org.jboss.jbossts.jta/narayana-jta

.transactionManager();
javax.transaction.Transaction tx = tm.getTransaction();
    if (!tx.delistResource(xares, XAResource.TMSUCCESS))
      throw new SQLException(
          jdbcLogger.i18NLogger.get_delisterror());
        tx.registerSynchronization(new ConnectionSynchronization(_theConnection, _recoveryConnection));
    throw new SQLException(jdbcLogger.i18NLogger.get_closeerrorinvalidtx(tx.toString()));
SQLException sqlException = new SQLException(jdbcLogger.i18NLogger.get_closeerror());
sqlException.initCause(e1);
throw sqlException;

代码示例来源:origin: org.nuiton.wikitty/wikitty-jdbc-impl

try {
  TransactionManager transactionManager =
      com.arjuna.ats.jta.TransactionManager.transactionManager();
      for(Entry<Object, Object> properties : conf.getFlatOptions().entrySet()) {
        String propertyName = (String) properties.getKey();
        if (propertyName.startsWith(

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();

    tm.begin();

    javax.transaction.Transaction theTransaction = tm.getTransaction();

    assertEquals(Status.STATUS_ACTIVE, theTransaction.getStatus());

    theTransaction.rollback();

    assertEquals(Status.STATUS_ROLLEDBACK, theTransaction.getStatus());

    assertEquals(Status.STATUS_ROLLEDBACK, tm.getStatus());

    theTransaction = tm.suspend();

    assertEquals(Status.STATUS_NO_TRANSACTION, tm.getStatus());

    tm.resume(theTransaction);

    assertEquals(Status.STATUS_ROLLEDBACK, tm.getStatus());

    tm.suspend();
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
public void test() throws Exception {
  javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager
      .transactionManager();
  tm.begin();
  javax.transaction.Transaction theTransaction = tm.getTransaction();
  assertTrue(theTransaction.enlistResource(new XARMERRXAResource(false)));
  XARMERRXAResource rollbackCalled = new XARMERRXAResource(true);
  assertTrue(theTransaction.enlistResource(rollbackCalled));
  tm.rollback();
  assertTrue(rollbackCalled.getRollbackCalled());
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();

    tm.begin();

    javax.transaction.Transaction theTransaction = tm.getTransaction();

    tm.commit();

    tm.resume(theTransaction);
  }
}

代码示例来源:origin: kiegroup/jbpm

com.arjuna.ats.jta.TransactionManager.transactionManager().begin();
try { 
  EntityManager em = getEmf().createEntityManager();
  query.executeUpdate();
  com.arjuna.ats.jta.TransactionManager.transactionManager().commit();
} catch( Throwable t ) { 
  com.arjuna.ats.jta.TransactionManager.transactionManager().rollback();

代码示例来源:origin: kiegroup/jbpm

@After
public void tearDown() throws Exception {
  javax.transaction.TransactionManager txm = com.arjuna.ats.jta.TransactionManager.transactionManager();
  assertTrue("There is still a transaction running!", txm.getTransaction() == null );
  
  cleanUp(context);
}

代码示例来源:origin: kiegroup/jbpm

Transaction tx = com.arjuna.ats.jta.TransactionManager.transactionManager()
    .getTransaction();
if (tx != null) {
  int testTxState = tx.getStatus();
  if (testTxState != Status.STATUS_NO_TRANSACTION
      && testTxState != Status.STATUS_ROLLEDBACK
      && testTxState != Status.STATUS_COMMITTED) {
    try {
      tx.rollback();
    } catch (Throwable t) {

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();

    tm.begin();

    Transaction tx = tm.getTransaction();

    tx.commit();

    assertEquals(Status.STATUS_COMMITTED, tm.getStatus());

    try {
      tm.begin();

      fail("Begin call completed successfully - this shouldn't have happened");
    }
    catch (NotSupportedException e)
    {
      System.out.println("NotSupportedException \""+e.getMessage()+"\" occurred this is expected and correct");
    }
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    for (int i = 0; i < 1000; i++)
    {
      javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();

      tm.begin();

      tm.getTransaction().rollback();

      tm.suspend();
    }
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
public void test() throws Exception
{
  TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
  tm.begin();
  Transaction tx = tm.suspend();
  tm.begin();
  tx.commit();
  tm.commit();
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();

    transactionManager.setTransactionTimeout(3);

    transactionManager.begin();

    Thread.currentThread().sleep(4000);

    try
    {
      transactionManager.commit();
    }
    catch (final javax.transaction.RollbackException ex)
    {
      // expected
    }
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void test() throws Exception
  {
    javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();

    transactionManager.setTransactionTimeout(3);

    transactionManager.begin();

    Thread.currentThread().sleep(4000);

    transactionManager.rollback();
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void testDisabled () throws Exception
  {
    jtaPropertyManager.getJTAEnvironmentBean().setSupportSubtransactions(false);

    javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();

    transactionManager.begin();

    try
    {
      transactionManager.begin();

      fail();
    }
    catch (final NotSupportedException ex)
    {
    }

    transactionManager.commit();
  }
}

代码示例来源:origin: org.jboss.jbossts/jbosstxbridge

/**
 * Disassociate the JTA transaction from the current Thread.
 * Typically used by a server side outbound handler.
 *
 * @throws XAException
 * @throws SystemException
 * @throws InvalidTransactionException
 */
public void stop() throws XAException, SystemException, InvalidTransactionException
{
  txbridgeLogger.logger.trace("InboundBridge.stop("+xid+")");
  TransactionManager.transactionManager().suspend();
}

相关文章

TransactionManager类方法