gpt4 book ai didi

bitronix.tm.internal.XAResourceHolderState.setTransactionTimeoutDate()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-25 18:19:05 27 4
gpt4 key购买 nike

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

XAResourceHolderState.setTransactionTimeoutDate介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.btm/btm

public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemException {
  if (status == Status.STATUS_NO_TRANSACTION)
    throw new IllegalStateException("transaction hasn't started yet");
  if (status == Status.STATUS_MARKED_ROLLBACK)
    throw new BitronixRollbackException("transaction has been marked as rollback only");
  if (isDone())
    throw new IllegalStateException("transaction started or finished 2PC, cannot enlist any more resource");
  XAResourceHolder resourceHolder = ResourceRegistrar.findXAResourceHolder(xaResource);
  if (resourceHolder == null)
    throw new BitronixSystemException("unknown XAResource " + xaResource + ", it does not belong to a registered resource");
  XAResourceHolderState resourceHolderState = new XAResourceHolderState(resourceHolder, resourceHolder.getResourceBean());
  // resource timeout must be set here so manually enlisted resources can receive it
  resourceHolderState.setTransactionTimeoutDate(timeoutDate);
  try {
    resourceManager.enlist(resourceHolderState);
  } catch (XAException ex) {
    String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
    if (BitronixXAException.isUnilateralRollback(ex)) {
      // if the resource unilaterally rolled back, the transaction will never be able to commit -> mark it as rollback only
      setStatus(Status.STATUS_MARKED_ROLLBACK);
      throw new BitronixRollbackException("resource " + resourceHolderState + " unilaterally rolled back, error=" +
          Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
    }
    throw new BitronixSystemException("cannot enlist " + resourceHolderState + ", error=" +
        Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
  }
  resourceHolder.putXAResourceHolderState(resourceHolderState.getXid(), resourceHolderState);
  return true;
}

代码示例来源:origin: bitronix/btm

@Override
public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemException {
  if (status == Status.STATUS_NO_TRANSACTION)
    throw new IllegalStateException("transaction hasn't started yet");
  if (status == Status.STATUS_MARKED_ROLLBACK)
    throw new BitronixRollbackException("transaction has been marked as rollback only");
  if (isDone())
    throw new IllegalStateException("transaction started or finished 2PC, cannot enlist any more resource");
  XAResourceHolder resourceHolder = ResourceRegistrar.findXAResourceHolder(xaResource);
  if (resourceHolder == null)
    throw new BitronixSystemException("unknown XAResource " + xaResource + ", it does not belong to a registered resource");
  XAResourceHolderState resourceHolderState = new XAResourceHolderState(resourceHolder, resourceHolder.getResourceBean());
  // resource timeout must be set here so manually enlisted resources can receive it
  resourceHolderState.setTransactionTimeoutDate(timeoutDate);
  try {
    resourceManager.enlist(resourceHolderState);
  } catch (XAException ex) {
    String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
    if (BitronixXAException.isUnilateralRollback(ex)) {
      // if the resource unilaterally rolled back, the transaction will never be able to commit -> mark it as rollback only
      setStatus(Status.STATUS_MARKED_ROLLBACK);
      throw new BitronixRollbackException("resource " + resourceHolderState + " unilaterally rolled back, error=" +
          Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
    }
    throw new BitronixSystemException("cannot enlist " + resourceHolderState + ", error=" +
        Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
  }
  resourceHolder.putXAResourceHolderState(resourceHolderState.getXid(), resourceHolderState);
  return true;
}

代码示例来源:origin: org.mule.btm/mule-btm

public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemException {
  if (status == Status.STATUS_NO_TRANSACTION)
    throw new IllegalStateException("transaction hasn't started yet");
  if (status == Status.STATUS_MARKED_ROLLBACK)
    throw new BitronixRollbackException("transaction has been marked as rollback only");
  if (isDone())
    throw new IllegalStateException("transaction started or finished 2PC, cannot enlist any more resource");
  XAResourceHolder resourceHolder = ResourceRegistrar.findXAResourceHolder(xaResource);
  if (resourceHolder == null)
    throw new BitronixSystemException("unknown XAResource " + xaResource + ", it does not belong to a registered resource");
  XAResourceHolderState resourceHolderState = new XAResourceHolderState(resourceHolder, resourceHolder.getResourceBean());
  // resource timeout must be set here so manually enlisted resources can receive it
  resourceHolderState.setTransactionTimeoutDate(timeoutDate);
  try {
    resourceManager.enlist(resourceHolderState);
  } catch (XAException ex) {
    String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
    if (BitronixXAException.isUnilateralRollback(ex)) {
      // if the resource unilaterally rolled back, the transaction will never be able to commit -> mark it as rollback only
      setStatus(Status.STATUS_MARKED_ROLLBACK);
      throw new BitronixRollbackException("resource " + resourceHolderState + " unilaterally rolled back, error=" +
          Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
    }
    throw new BitronixSystemException("cannot enlist " + resourceHolderState + ", error=" +
        Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
  }
  resourceHolder.putXAResourceHolderState(resourceHolderState.getXid(), resourceHolderState);
  return true;
}

代码示例来源:origin: com.github.marcus-nl.btm/btm

@Override
public boolean enlistResource(XAResource xaResource) throws RollbackException, IllegalStateException, SystemException {
  if (status == Status.STATUS_NO_TRANSACTION)
    throw new IllegalStateException("transaction hasn't started yet");
  if (status == Status.STATUS_MARKED_ROLLBACK)
    throw new BitronixRollbackException("transaction has been marked as rollback only");
  if (isDone())
    throw new IllegalStateException("transaction started or finished 2PC, cannot enlist any more resource");
  XAResourceHolder resourceHolder = ResourceRegistrar.findXAResourceHolder(xaResource);
  if (resourceHolder == null)
    throw new BitronixSystemException("unknown XAResource " + xaResource + ", it does not belong to a registered resource");
  XAResourceHolderState resourceHolderState = new XAResourceHolderState(resourceHolder, resourceHolder.getResourceBean());
  // resource timeout must be set here so manually enlisted resources can receive it
  resourceHolderState.setTransactionTimeoutDate(timeoutDate);
  try {
    resourceManager.enlist(resourceHolderState);
  } catch (XAException ex) {
    String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
    if (BitronixXAException.isUnilateralRollback(ex)) {
      // if the resource unilaterally rolled back, the transaction will never be able to commit -> mark it as rollback only
      setStatus(Status.STATUS_MARKED_ROLLBACK);
      throw new BitronixRollbackException("resource " + resourceHolderState + " unilaterally rolled back, error=" +
          Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
    }
    throw new BitronixSystemException("cannot enlist " + resourceHolderState + ", error=" +
        Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
  }
  resourceHolder.putXAResourceHolderState(resourceHolderState.getXid(), resourceHolderState);
  return true;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com