• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocalTransactionException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.resource.spi.LocalTransactionException的典型用法代码示例。如果您正苦于以下问题:Java LocalTransactionException类的具体用法?Java LocalTransactionException怎么用?Java LocalTransactionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocalTransactionException类属于javax.resource.spi包,在下文中一共展示了LocalTransactionException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: localTransactionCommit

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
protected void localTransactionCommit(boolean isSPI) throws ResourceException {
    try {
        // according to the JDBC spec, reenabling autoCommit commits any current transaction
        // we need to do both here, so we rely on this behaviour in the driver as otherwise
        // commit followed by setAutoCommit(true) may result in 2 commits in the database
        if (mcf.isCommitBeforeAutocommit()) {
            connection.commit();
        }
        connection.setAutoCommit(true);
    } catch (SQLException e) {
        try {
            connection.rollback();
        } catch (SQLException e1) {
            if (log != null) {
                e.printStackTrace(log);
            }
        }
        throw new LocalTransactionException("Unable to commit", e);
    }
    super.localTransactionCommit(isSPI);
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:22,代码来源:ManagedPooledConnection.java


示例2: localTransactionCommit

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
protected void localTransactionCommit(boolean isSPI) throws ResourceException {
    try {
        if (mcf.isCommitBeforeAutocommit()) {
            getPhysicalConnection().commit();
        }
        getPhysicalConnection().setAutoCommit(true);
    } catch (SQLException e) {
        try {
            getPhysicalConnection().rollback();
        } catch (SQLException e1) {
            if (log != null) {
                e.printStackTrace(log);
            }
        }
        throw new LocalTransactionException("Unable to commit", e);
    }
    super.localTransactionCommit(isSPI);
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:19,代码来源:ManagedJDBCConnection.java


示例3: localTransactionStart

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
protected void localTransactionStart(boolean isSPI) throws ResourceException {
    try {
        connection.setAutoCommit(false);
    } catch (SQLException e) {
        throw new LocalTransactionException("Unable to disable autoCommit", e);
    }
    super.localTransactionStart(isSPI);
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:9,代码来源:ManagedPooledConnection.java


示例4: localTransactionStart

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
protected void localTransactionStart(boolean isSPI) throws ResourceException {
    try {
        getPhysicalConnection().setAutoCommit(false);
    } catch (SQLException e) {
        throw new LocalTransactionException("Unable to disable autoCommit", e);
    }
    super.localTransactionStart(isSPI);
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:9,代码来源:ManagedJDBCConnection.java


示例5: commit

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
public void commit() throws ResourceException {
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCALocalTransaction:commit");
    } catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  LogWriter logger = cache.getLogger();
  if (logger.fineEnabled()) {
    logger.fine("JCALocalTransaction:invoked commit");
  }
  TXStateProxy tsp = this.gfTxMgr.getTXState();
  if (tsp != null && this.tid != tsp.getTransactionId()) {
    throw new IllegalStateException("Local Transaction associated with Tid = " + this.tid
        + " attempting to commit a different transaction");
  }
  try {
    this.gfTxMgr.commit();
    this.tid = null;
  } catch (Exception e) {
    throw new LocalTransactionException(e.toString());
  }
  // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
  // ConnectionEvent ce = new
  // ConnectionEvent(this,ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
  // while( itr.hasNext()) {
  // itr.next().localTransactionCommitted(ce);
  // }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:32,代码来源:JCALocalTransaction.java


示例6: commit

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
public void commit() throws ResourceException
{
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCALocalTransaction:commit");
    }
    catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  LogWriter logger = cache.getLogger();
  if (logger.fineEnabled()) {
    logger.fine("JCALocalTransaction:invoked commit");
  }
  TXStateInterface tsp = this.gfTxMgr.getTXState();
  if (tsp != null && this.tid != tsp.getTransactionId()) {
    throw new IllegalStateException(
        "Local Transaction associated with Tid = " + this.tid
            + " attempting to commit a different transaction");
  }
  try {
    this.gfTxMgr.commit();
    this.tid = null;
  }
  catch (Exception e) {
    throw new LocalTransactionException(e.toString());
  }
  // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
  // ConnectionEvent ce = new
  // ConnectionEvent(this,ConnectionEvent.LOCAL_TRANSACTION_COMMITTED);
  // while( itr.hasNext()) {
  // itr.next().localTransactionCommitted(ce);
  // }

}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:36,代码来源:JCALocalTransaction.java


示例7: begin

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
public void begin() throws ResourceException {
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCALocalTransaction:begin");
    } catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  try {
    if (!initDone || this.cache.isClosed()) {
      this.init();
    }
    // System.out.println("JCALocalTransaction:Asif: cache is ="+cache +
    // " for tx ="+this);
    LogWriter logger = cache.getLogger();
    if (logger.fineEnabled()) {
      logger.fine("JCALocalTransaction::begin:");
    }
    TransactionManager tm = cache.getJTATransactionManager();
    if (this.tid != null) {
      throw new LocalTransactionException(" A transaction is already in progress");
    }
    if (tm != null && tm.getTransaction() != null) {
      if (logger.fineEnabled()) {
        logger.fine("JCAManagedConnection: JTA transaction is on");
      }
      // This is having a JTA transaction. Assuming ignore jta flag is true,
      // explicitly being a gemfire transaction.
      TXStateProxy tsp = this.gfTxMgr.getTXState();
      if (tsp == null) {
        this.gfTxMgr.begin();
        tsp = this.gfTxMgr.getTXState();
        tsp.setJCATransaction();
        this.tid = tsp.getTransactionId();
        if (logger.fineEnabled()) {
          logger.fine("JCALocalTransaction:begun GFE transaction");
        }
      } else {
        throw new LocalTransactionException("GemFire is already associated with a transaction");
      }
    } else {
      if (logger.fineEnabled()) {
        logger.fine("JCAManagedConnection: JTA Transaction does not exist.");
      }
    }
  } catch (SystemException e) {
    // this.onError();
    throw new ResourceException(e);
  }
  // Not to be invoked for local transactions managed by the container
  // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
  // ConnectionEvent ce = new ConnectionEvent(this,
  // ConnectionEvent.LOCAL_TRANSACTION_STARTED);
  // while (itr.hasNext()) {
  // itr.next().localTransactionStarted(ce);
  // }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:59,代码来源:JCALocalTransaction.java


示例8: begin

import javax.resource.spi.LocalTransactionException; //导入依赖的package包/类
public void begin() throws ResourceException
{
  if (DEBUG) {
    try {
      throw new NullPointerException("Asif:JCALocalTransaction:begin");
    }
    catch (NullPointerException npe) {
      npe.printStackTrace();
    }
  }
  try {
    if (!initDone || this.cache.isClosed()) {
      this.init();
    }
    // System.out.println("JCALocalTransaction:Asif: cache is ="+cache +
    // " for tx ="+this);
    LogWriter logger = cache.getLogger();
    if (logger.fineEnabled()) {
      logger.fine("JCALocalTransaction::begin:");
    }
    TransactionManager tm = cache.getJTATransactionManager();
    if (this.tid != null) {
      throw new LocalTransactionException(
          " A transaction is already in progress");
    }
    if (tm != null && tm.getTransaction() != null) {
      if (logger.fineEnabled()) {
        logger.fine("JCAManagedConnection: JTA transaction is on");
      }
      // This is having a JTA transaction. Assuming ignore jta flag is true,
      // explicitly being a gemfire transaction.
      TXStateInterface tsp = this.gfTxMgr.getTXState();
      if (tsp == null) {
        this.gfTxMgr.begin();
        tsp = this.gfTxMgr.getTXState();
        tsp.getProxy().setJCA(true);
        this.tid = tsp.getTransactionId();
        if (logger.fineEnabled()) {
          logger.fine("JCALocalTransaction:begun GFE transaction");
        }
      }
      else {
        throw new LocalTransactionException(
            "GemFire is already associated with a transaction");
      }
    }
    else {
      if (logger.fineEnabled()) {
        logger.fine("JCAManagedConnection: JTA Transaction does not exist.");
      }
    }
  }
  catch (SystemException e) {
    // this.onError();
    throw new ResourceException(e);
  }
  // Not to be invoked for local transactions managed by the container
  // Iterator<ConnectionEventListener> itr = this.listeners.iterator();
  // ConnectionEvent ce = new ConnectionEvent(this,
  // ConnectionEvent.LOCAL_TRANSACTION_STARTED);
  // while (itr.hasNext()) {
  // itr.next().localTransactionStarted(ce);
  // }

}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:66,代码来源:JCALocalTransaction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Path类代码示例发布时间:2022-05-22
下一篇:
Java ImageOptions类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap