public void setXid(BitronixXid xid) throws BitronixSystemException { if (log.isDebugEnabled()) log.debug("assigning <" + xid + "> to <" + this + ">"); if (this.xid != null && !xid.equals(this.xid)) throw new BitronixSystemException("a XID has already been assigned to " + this); this.xid = xid; }
public void setXid(BitronixXid xid) throws BitronixSystemException { if (log.isDebugEnabled()) log.debug("assigning <" + xid + "> to <" + this + ">"); if (this.xid != null && !xid.equals(this.xid)) throw new BitronixSystemException("a XID has already been assigned to " + this); this.xid = xid; }
public void setXid(BitronixXid xid) throws BitronixSystemException { if (log.isDebugEnabled()) { log.debug("assigning <" + xid + "> to <" + this + ">"); } if (this.xid != null && !xid.equals(this.xid)) throw new BitronixSystemException("a XID has already been assigned to " + this); this.xid = xid; hashCode = 17 * (bean.hashCode() + (xid != null ? xid.hashCode() : 0)); }
public void setXid(BitronixXid xid) throws BitronixSystemException { if (log.isDebugEnabled()) { log.debug("assigning <" + xid + "> to <" + this + ">"); } if (this.xid != null && !xid.equals(this.xid)) throw new BitronixSystemException("a XID has already been assigned to " + this); this.xid = xid; hashCode = 17 * (bean.hashCode() + (xid != null ? xid.hashCode() : 0)); }
@Override public void setTransactionTimeout(int seconds) throws SystemException { if (seconds < 0) throw new BitronixSystemException("cannot set a timeout to less than 0 second (was: " + seconds + "s)"); ThreadContext.getThreadContext().setTimeout(seconds); }
public void setTransactionTimeout(int seconds) throws SystemException { if (seconds < 0) throw new BitronixSystemException("cannot set a timeout to less than 0 second (was: " + seconds + "s)"); getOrCreateCurrentContext().setTimeout(seconds); }
@Override public void setTransactionTimeout(int seconds) throws SystemException { if (seconds < 0) throw new BitronixSystemException("cannot set a timeout to less than 0 second (was: " + seconds + "s)"); ThreadContext.getThreadContext().setTimeout(seconds); }
public void setTransactionTimeout(int seconds) throws SystemException { if (seconds < 0) throw new BitronixSystemException("cannot set a timeout to less than 0 second (was: " + seconds + "s)"); getOrCreateCurrentContext().setTimeout(seconds); }
@Override public Transaction suspend() throws SystemException { BitronixTransaction currentTx = getCurrentTransaction(); if (log.isDebugEnabled()) { log.debug("suspending transaction " + currentTx); } if (currentTx == null) return null; try { currentTx.getResourceManager().suspend(); clearCurrentContextForSuspension(); inFlightTransactions.get(currentTx).setThreadContext(null); MDC.remove(MDC_GTRID_KEY); return currentTx; } catch (XAException ex) { String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); throw new BitronixSystemException("cannot suspend " + currentTx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
@Override public Transaction suspend() throws SystemException { BitronixTransaction currentTx = getCurrentTransaction(); if (log.isDebugEnabled()) { log.debug("suspending transaction " + currentTx); } if (currentTx == null) return null; try { currentTx.getResourceManager().suspend(); clearCurrentContextForSuspension(); inFlightTransactions.get(currentTx).setThreadContext(null); MDC.remove(MDC_GTRID_KEY); return currentTx; } catch (XAException ex) { String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); throw new BitronixSystemException("cannot suspend " + currentTx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
public Transaction suspend() throws SystemException { BitronixTransaction currentTx = getCurrentTransaction(); if (log.isDebugEnabled()) log.debug("suspending transaction " + currentTx); if (currentTx == null) return null; try { currentTx.getResourceManager().suspend(); clearCurrentContextForSuspension(); return currentTx; } catch (XAException ex) { String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); throw new BitronixSystemException("cannot suspend " + currentTx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
public Transaction suspend() throws SystemException { BitronixTransaction currentTx = getCurrentTransaction(); if (log.isDebugEnabled()) log.debug("suspending transaction " + currentTx); if (currentTx == null) return null; try { currentTx.getResourceManager().suspend(); clearCurrentContextForSuspension(); return currentTx; } catch (XAException ex) { String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); throw new BitronixSystemException("cannot suspend " + currentTx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
public void setStatus(int status, Set<String> uniqueNames) throws BitronixSystemException { try { boolean force = (resourceManager.size() > 1) && (status == Status.STATUS_COMMITTING); if (log.isDebugEnabled()) log.debug("changing transaction status to " + Decoder.decodeStatus(status) + (force ? " (forced)" : "")); int oldStatus = this.status; this.status = status; journal.log(status, resourceManager.getGtrid(), uniqueNames); if (force) { journal.force(); } if (status == Status.STATUS_ACTIVE) ManagementRegistrar.register("bitronix.tm:type=Transaction,Gtrid=" + resourceManager.getGtrid(), this); fireTransactionStatusChangedEvent(oldStatus, status); } catch (IOException ex) { // if we cannot log, the TM must stop managing TX until the problem is fixed throw new BitronixSystemException("error logging status", ex); } }
public void setStatus(int status, Set<String> uniqueNames) throws BitronixSystemException { try { boolean force = (resourceManager.size() > 1) && (status == Status.STATUS_COMMITTING); if (log.isDebugEnabled()) log.debug("changing transaction status to " + Decoder.decodeStatus(status) + (force ? " (forced)" : "")); int oldStatus = this.status; this.status = status; journal.log(status, resourceManager.getGtrid(), uniqueNames); if (force) { journal.force(); } if (status == Status.STATUS_ACTIVE) ManagementRegistrar.register("bitronix.tm:type=Transaction,Gtrid=" + resourceManager.getGtrid(), this); fireTransactionStatusChangedEvent(oldStatus, status); } catch (IOException ex) { // if we cannot log, the TM must stop managing TX until the problem is fixed throw new BitronixSystemException("error logging status", ex); } }
public void setStatus(int status, Set<String> uniqueNames) throws BitronixSystemException { try { boolean force = (resourceManager.size() > 1) && (status == Status.STATUS_COMMITTING); if (log.isDebugEnabled()) { log.debug("changing transaction status to " + Decoder.decodeStatus(status) + (force ? " (forced)" : "")); } int oldStatus = this.status; this.status = status; Journal journal = TransactionManagerServices.getJournal(); journal.log(status, resourceManager.getGtrid(), uniqueNames); if (force) { journal.force(); } if (status == Status.STATUS_ACTIVE) ManagementRegistrar.register("bitronix.tm:type=Transaction,Gtrid=" + resourceManager.getGtrid(), this); fireTransactionStatusChangedEvent(oldStatus, status); } catch (IOException ex) { // if we cannot log, the TM must stop managing TX until the problem is fixed throw new BitronixSystemException("error logging status", ex); } }
public void setStatus(int status, Set<String> uniqueNames) throws BitronixSystemException { try { boolean force = (resourceManager.size() > 1) && (status == Status.STATUS_COMMITTING); if (log.isDebugEnabled()) { log.debug("changing transaction status to " + Decoder.decodeStatus(status) + (force ? " (forced)" : "")); } int oldStatus = this.status; this.status = status; Journal journal = TransactionManagerServices.getJournal(); journal.log(status, resourceManager.getGtrid(), uniqueNames); if (force) { journal.force(); } if (status == Status.STATUS_ACTIVE) ManagementRegistrar.register("bitronix.tm:type=Transaction,Gtrid=" + resourceManager.getGtrid(), this); fireTransactionStatusChangedEvent(oldStatus, status); } catch (IOException ex) { // if we cannot log, the TM must stop managing TX until the problem is fixed throw new BitronixSystemException("error logging status", ex); } }
public void resume(Transaction transaction) throws InvalidTransactionException, IllegalStateException, SystemException { if (log.isDebugEnabled()) log.debug("resuming " + transaction); if (transaction == null) throw new InvalidTransactionException("resumed transaction cannot be null"); if (!(transaction instanceof BitronixTransaction)) throw new InvalidTransactionException("resumed transaction must be an instance of BitronixTransaction"); BitronixTransaction tx = (BitronixTransaction) transaction; BitronixTransaction currentTx = getCurrentTransaction(); if (currentTx != null) throw new IllegalStateException("a transaction is already running on this thread"); try { XAResourceManager resourceManager = tx.getResourceManager(); resourceManager.resume(); ThreadContext ctx = new ThreadContext(); ctx.setTransaction(tx); setCurrentContext(ctx); } catch (XAException ex) { String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); throw new BitronixSystemException("cannot resume " + tx + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
private boolean delistResource(XAResourceHolderState resourceHolderState, int flag) throws BitronixSystemException { try { return resourceManager.delist(resourceHolderState, flag); } catch (XAException ex) { // if the resource could not be delisted, the transaction must not commit -> mark it as rollback only if (status != Status.STATUS_MARKED_ROLLBACK) setStatus(Status.STATUS_MARKED_ROLLBACK); String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); if (BitronixXAException.isUnilateralRollback(ex)) { // The resource unilaterally rolled back here. We have to throw an exception to indicate this but // The signature of this method is inherited from javax.transaction.Transaction. Thereof, we have choice // between creating a sub-exception of SystemException or using a RuntimeException. Is that the best way // forward as this 'hidden' exception can be left throw out at unexpected locations where SystemException // should be rethrown but the exception thrown here should be catched & handled... ? throw new BitronixRollbackSystemException("resource " + resourceHolderState + " unilaterally rolled back, error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } throw new BitronixSystemException("cannot delist " + resourceHolderState + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
private boolean delistResource(XAResourceHolderState resourceHolderState, int flag) throws BitronixSystemException { try { return resourceManager.delist(resourceHolderState, flag); } catch (XAException ex) { // if the resource could not be delisted, the transaction must not commit -> mark it as rollback only if (status != Status.STATUS_MARKED_ROLLBACK) setStatus(Status.STATUS_MARKED_ROLLBACK); String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); if (BitronixXAException.isUnilateralRollback(ex)) { // The resource unilaterally rolled back here. We have to throw an exception to indicate this but // The signature of this method is inherited from javax.transaction.Transaction. Thereof, we have choice // between creating a sub-exception of SystemException or using a RuntimeException. Is that the best way // forward as this 'hidden' exception can be left throw out at unexpected locations where SystemException // should be rethrown but the exception thrown here should be catched & handled... ? throw new BitronixRollbackSystemException("resource " + resourceHolderState + " unilaterally rolled back, error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } throw new BitronixSystemException("cannot delist " + resourceHolderState + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }
private boolean delistResource(XAResourceHolderState resourceHolderState, int flag) throws BitronixSystemException { try { return resourceManager.delist(resourceHolderState, flag); } catch (XAException ex) { // if the resource could not be delisted, the transaction must not commit -> mark it as rollback only if (status != Status.STATUS_MARKED_ROLLBACK) setStatus(Status.STATUS_MARKED_ROLLBACK); String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex); if (BitronixXAException.isUnilateralRollback(ex)) { // The resource unilaterally rolled back here. We have to throw an exception to indicate this but // The signature of this method is inherited from javax.transaction.Transaction. Thereof, we have choice // between creating a sub-exception of SystemException or using a RuntimeException. Is that the best way // forward as this 'hidden' exception can be left throw out at unexpected locations where SystemException // should be rethrown but the exception thrown here should be catched & handled... ? throw new BitronixRollbackSystemException("resource " + resourceHolderState + " unilaterally rolled back, error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } throw new BitronixSystemException("cannot delist " + resourceHolderState + ", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex); } }