Package org.fto.jthink.transaction

Examples of org.fto.jthink.transaction.TransactionManager


    ResourceManager resManager = new ResourceManager();
    /* 将配置文件加入到资源管理器中 */
    resManager.setResource(Configuration.class.getName(), config);
   
    /* 初始化事务管理器 */
    TransactionManager transactionManager = new DefaultTransactionManager(resManager, config);
    /* 将事务管理器加入到资源管理器中 */
    resManager.setResource(TransactionManager.class.getName(), transactionManager);
   
    /* 返回在fto-jthink.xml中配置的JDBC事务 */
    TransactionFactory transactionFactory = transactionManager.getTransactionFactory("SampleTransaction");
    JDBCTransaction transaction  = (JDBCTransaction)transactionFactory.create();
    /* 将此事务处理对象加入到事务管理器中 */
    transactionManager.addTransaction(JDBCTransaction.class.getName(), transaction);
    resManager.setResource(JDBCTransaction.class.getName(), transaction);
   
    return resManager;
  }
View Full Code Here


    /* 事务 */
    if(getResource(TransactionManager.class.getName())==null){
      Configuration config = Configuration.getConfiguration();
      /* 设置资源, 初始化事务管理器, 将TransactionManager加入到ResourceManager中 */
      TransactionManager transactionManager = new DefaultTransactionManager(this, config);
      setResource(TransactionManager.class.getName(), transactionManager);
     
      /* 设置资源,初始化事务工厂 */
      Element transactions = config.getConfig().getChild("transactions");
      if(transactions!=null){
        Iterator transactionsIT = transactions.getChildren().iterator();
        while(transactionsIT.hasNext()){
          Element transaction = (Element)transactionsIT.next();
          /* 创建事务工厂 */
          transactionManager.getTransactionFactory(transaction.getAttributeValue("id"));
        }
      }
    }
  }
View Full Code Here

    Configuration jthinkConfig = (Configuration)resManager.getResource(WEBApplicationContext.class.getName(), Configuration.class.getName());
   
    if(resManager.getResource(TransactionManager.class.getName())==null){
      /* 设置资源, 初始化事务管理器, 将TransactionManager加入到ResourceManager中 */
      logger.debug("初始化事务管理器, TransactionManager.");
      TransactionManager transactionManager = new DefaultTransactionManager(resManager, jthinkConfig);
      resManager.setResource(TransactionManager.class.getName(), transactionManager);
     
      // 加入WEB端事务到事务管理器
      logger.debug("初始化Web端事务, WebTransaction.");
      TransactionFactory transactionFactory = transactionManager.getTransactionFactory("WebTransaction");
      JDBCTransaction transaction  = (JDBCTransaction)transactionFactory.create();
      transactionManager.addTransaction(JDBCTransaction.class.getName(), transaction);
     
    }
   
    return resManager;
  }
View Full Code Here

TOP

Related Classes of org.fto.jthink.transaction.TransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.