org.milyn.container.ExecutionContext.getTerminationError()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(101)

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

ExecutionContext.getTerminationError介绍

[英]Set the error/exception that caused the filter operation associated with this ExecutionContext to terminate.
[中]设置导致与此ExecutionContext关联的筛选器操作终止的错误/异常。

代码示例

代码示例来源:origin: smooks/smooks

protected void unbind(ExecutionContext executionContext) {
  try {
    Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
    if(connection != null) {
      TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX  + getName());
      if(transactionManager == null) {
        throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'");
      }
      try {
        if(!isAutoCommit()) {
          // If there's no termination error on the context, commit, otherwise rollback...
          if(executionContext.getTerminationError() == null) {
            transactionManager.commit();
          } else {
            transactionManager.rollback();
          }
        }
      } finally {
        executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
        connection.close();
      }
    }
  } catch (SQLException e) {
    throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e);
  } finally {
    executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName());
    executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName());
  }
}

代码示例来源:origin: org.virtuslab/milyn-smooks-core

protected void unbind(ExecutionContext executionContext) {
  try {
    Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
    if(connection != null) {
      TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX  + getName());
      if(transactionManager == null) {
        throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'");
      }
      try {
        if(!isAutoCommit()) {
          // If there's no termination error on the context, commit, otherwise rollback...
          if(executionContext.getTerminationError() == null) {
            transactionManager.commit();
          } else {
            transactionManager.rollback();
          }
        }
      } finally {
        executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
        connection.close();
      }
    }
  } catch (SQLException e) {
    throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e);
  } finally {
    executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName());
    executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName());
  }
}

代码示例来源:origin: org.milyn/milyn-smooks-core

protected void unbind(ExecutionContext executionContext) {
  try {
    Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
    if(connection != null) {
      TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX  + getName());
      if(transactionManager == null) {
        throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'");
      }
      try {
        if(!isAutoCommit()) {
          // If there's no termination error on the context, commit, otherwise rollback...
          if(executionContext.getTerminationError() == null) {
            transactionManager.commit();
          } else {
            transactionManager.rollback();
          }
        }
      } finally {
        executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
        connection.close();
      }
    }
  } catch (SQLException e) {
    throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e);
  } finally {
    executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName());
    executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName());
  }
}

代码示例来源:origin: org.milyn/milyn-smooks-all

protected void unbind(ExecutionContext executionContext) {
  try {
    Connection connection = (Connection) executionContext.getAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
    if(connection != null) {
      TransactionManager transactionManager = (TransactionManager) executionContext.getAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX  + getName());
      if(transactionManager == null) {
        throw new SmooksException("No TransactionManager is set for the datasource '" + getName() + "'");
      }
      try {
        if(!isAutoCommit()) {
          // If there's no termination error on the context, commit, otherwise rollback...
          if(executionContext.getTerminationError() == null) {
            transactionManager.commit();
          } else {
            transactionManager.rollback();
          }
        }
      } finally {
        executionContext.removeAttribute(CONNECTION_CONTEXT_KEY_PREFIX + getName());
        connection.close();
      }
    }
  } catch (SQLException e) {
    throw new SmooksException("Unable to unbind DataSource '" + getName() + "'.", e);
  } finally {
    executionContext.removeAttribute(DS_CONTEXT_KEY_PREFIX + getName());
    executionContext.removeAttribute(TRANSACTION_MANAGER_CONTEXT_KEY_PREFIX + getName());
  }
}

相关文章