• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JdbcTransactionObjectSupport类的典型用法和代码示例

java 1次浏览

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

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

示例1: doCommit

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
@Override
protected void doCommit(DefaultTransactionStatus status) {
    String prefix="";
    if(logger.isDebugEnabled()) {
        prefix += "[" + TransactionId.get().getCurrentId() + "]";
        try {
            Connection connection = ((JdbcTransactionObjectSupport)status.getTransaction()).getConnectionHolder().getConnection();
            prefix += "[" + (null != connection ? connection : "") + "]";
        } catch (Exception e) {}
    }
    logger.debug(prefix+"DataSource doCommit");
    //将status持久化到jvm内存
    if(null!=TransactionContextFactory.getInstance()&& TransactionSupport.isProxy()){
        logger.debug(prefix+"DataSource doCommit before store");
        Transaction transaction=TransactionContextFactory.getInstance().persistent(status);
        if(transaction instanceof DBTransaction){
            logger.debug(prefix+"DataSource doCommit in store");
            DBTransaction dbT=(DBTransaction)transaction;
            dbT.setDataSource(getDataSource());
            dbT.setIsNewConnectionHolder(checkNewConnectionHolder(status.getTransaction()));
        }
    }else{//如果事务容器工厂类初始化失败,执行默认逻辑
        logger.debug(prefix+"DataSource doCommit don't store");
        super.doCommit(status);
        super.doCleanupAfterCompletion(status.getTransaction());
    }
}
 

开发者ID:zhangkewei,
项目名称:dubbo-transaction,
代码行数:28,
代码来源:DubboTransactionDataSourceTransactonManager.java

示例2: prepare

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
public boolean prepare(){
    try {
        if (status.getTransaction() instanceof JdbcTransactionObjectSupport) {
            JdbcTransactionObjectSupport support = (JdbcTransactionObjectSupport) status.getTransaction();
            ConnectionHolder holder = support.getConnectionHolder();
            Connection con = holder.getConnection();
            return !con.isClosed() && !con.isReadOnly();
        }
    }catch (Exception e){
    }
    return false;
}
 

开发者ID:zhangkewei,
项目名称:dubbo-transaction,
代码行数:13,
代码来源:DBTransaction.java

示例3: commit

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
@Override
public boolean commit() throws SQLException {
    logger.debug("[realDbCommit]"+getTransactionId().getCurrentId());
    if(status.getTransaction() instanceof JdbcTransactionObjectSupport){
        JdbcTransactionObjectSupport support=(JdbcTransactionObjectSupport)status.getTransaction();
        ConnectionHolder holder=support.getConnectionHolder();
        Connection con = holder.getConnection();
        con.commit();
        logger.debug("[realDbCommit]["+getTransactionId().getCurrentId()+"]"+con);
    }
    clearConnection();
    return true;
}
 

开发者ID:zhangkewei,
项目名称:dubbo-transaction,
代码行数:14,
代码来源:DBTransaction.java

示例4: rollback

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
@Override
public boolean rollback() throws SQLException {
    if(status.getTransaction() instanceof JdbcTransactionObjectSupport) {
        JdbcTransactionObjectSupport support = (JdbcTransactionObjectSupport) status.getTransaction();
        ConnectionHolder holder = support.getConnectionHolder();
        Connection con = holder.getConnection();
        con.rollback();
    }
    clearConnection();
    return true;
}
 

开发者ID:zhangkewei,
项目名称:dubbo-transaction,
代码行数:12,
代码来源:DBTransaction.java

示例5: getTransactionOpaqueIdentity

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
@Override
public Object getTransactionOpaqueIdentity() {
	JdbcTransactionObjectSupport txImplementation = (JdbcTransactionObjectSupport) ((DefaultTransactionStatus) getCurrentTransactionStatus())
			.getTransaction();
	return txImplementation.getConnectionHolder().getConnectionHandle();
}
 

开发者ID:victorrentea,
项目名称:training,
代码行数:7,
代码来源:TransactionUtilImpl.java

示例6: getTransactionOpaqueIdentity

点赞 2

import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport; //导入依赖的package包/类
public Object getTransactionOpaqueIdentity() {
	JdbcTransactionObjectSupport txImplementation = (JdbcTransactionObjectSupport) ((DefaultTransactionStatus) getCurrentTransactionStatus())
			.getTransaction();
	return txImplementation.getConnectionHolder().getConnectionHandle();
}
 

开发者ID:victorrentea,
项目名称:training,
代码行数:6,
代码来源:TransactionUtil.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)