@Override public void registerSynchronization(Synchronization synchronization) 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 is done, cannot register any more synchronization"); if (log.isDebugEnabled()) { log.debug("registering synchronization " + synchronization); } synchronizationScheduler.add(synchronization, Scheduler.DEFAULT_POSITION); }
public void registerSynchronization(Synchronization synchronization) 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 is done, cannot register any more synchronization"); if (log.isDebugEnabled()) log.debug("registering synchronization " + synchronization); synchronizationScheduler.add(synchronization, Scheduler.DEFAULT_POSITION); }
public void registerSynchronization(Synchronization synchronization) 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 is done, cannot register any more synchronization"); if (log.isDebugEnabled()) log.debug("registering synchronization " + synchronization); synchronizationScheduler.add(synchronization, Scheduler.DEFAULT_POSITION); }
@Override public void registerSynchronization(Synchronization synchronization) 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 is done, cannot register any more synchronization"); if (log.isDebugEnabled()) { log.debug("registering synchronization " + synchronization); } synchronizationScheduler.add(synchronization, Scheduler.DEFAULT_POSITION); }
throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " unilaterally finished transaction branch before being asked to prepare", phaseException); else throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception", phaseException);
throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " unilaterally finished transaction branch before being asked to prepare", phaseException); else throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception", phaseException);
throw new BitronixRollbackException(sb.toString());
throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " unilaterally finished transaction branch before being asked to prepare", phaseException); else throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception", phaseException);
throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " unilaterally finished transaction branch before being asked to prepare", phaseException); else throw new BitronixRollbackException(message + ":" + " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception", phaseException);
throw new BitronixRollbackException(sb.toString());
throw new BitronixRollbackException(sb.toString());
throw new BitronixRollbackException(sb.toString());
} catch (BitronixSystemException ex) { rollback(); throw new BitronixRollbackException("SystemException thrown during beforeCompletion cycle caused transaction rollback", ex); } catch (RuntimeException ex) { rollback(); throw new BitronixRollbackException("RuntimeException thrown during beforeCompletion cycle caused transaction rollback", ex); if (log.isDebugEnabled()) log.debug("transaction timed out"); rollback(); throw new BitronixRollbackException("transaction timed out and has been rolled back"); rollback(); throw new BitronixRollbackException("delistment error caused transaction rollback" + ex.getMessage()); if (log.isDebugEnabled()) log.debug("transaction marked as rollback only"); rollback(); throw new BitronixRollbackException("transaction was marked as rollback only and has been rolled back"); throw new BitronixRollbackException("transaction failed to prepare: " + this, ex);
if (onePhase) { transaction.setStatus(Status.STATUS_ROLLEDBACK); throw new BitronixRollbackException("transaction failed during 1PC commit of " + transaction, ex); } else { transaction.setStatus(Status.STATUS_UNKNOWN);
if (onePhase) { transaction.setStatus(Status.STATUS_ROLLEDBACK); throw new BitronixRollbackException("transaction failed during 1PC commit of " + transaction, ex); } else { transaction.setStatus(Status.STATUS_UNKNOWN);
if (onePhase) { transaction.setStatus(Status.STATUS_ROLLEDBACK); throw new BitronixRollbackException("transaction failed during 1PC commit of " + transaction, ex); } else { transaction.setStatus(Status.STATUS_UNKNOWN);
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; }
@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; }
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; }
@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; }