@Override public String getStatusDescription() { return Decoder.decodeStatus(status); }
/** * Create human-readable String representation. * @return a human-readable String representing this object's state. */ public String toString() { return "a Bitronix TransactionLogHeader with timestamp=" + timestamp + ", state=" + Decoder.decodeHeaderState(state) + ", position=" + position; }
public void setState(int state) { int oldState = this.state; fireStateChanging(oldState, state); if (oldState == state) throw new IllegalArgumentException("cannot switch state from " + Decoder.decodeXAStatefulHolderState(oldState) + " to " + Decoder.decodeXAStatefulHolderState(state)); if (log.isDebugEnabled()) log.debug("state changing from " + Decoder.decodeXAStatefulHolderState(oldState) + " to " + Decoder.decodeXAStatefulHolderState(state) + " in " + this); this.state = state; fireStateChanged(oldState, state); }
throw new BitronixXAException("resource already suspended: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) log.debug("suspending " + this + " with " + Decoder.decodeXAResourceFlag(flags)); suspended = true; if (log.isDebugEnabled()) log.debug("ending " + this + " with " + Decoder.decodeXAResourceFlag(flags)); ended = true; if (log.isDebugEnabled()) log.debug("ended " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } catch(XAException ex) {
private void handleXAException(XAResourceHolderState failedResourceHolder, XAException xaException) throws XAException { switch (xaException.errorCode) { case XAException.XA_HEURRB: forgetHeuristicRollback(failedResourceHolder); return; case XAException.XA_HEURCOM: case XAException.XA_HEURHAZ: case XAException.XA_HEURMIX: log.error("heuristic rollback is incompatible with the global state of this transaction - guilty: " + failedResourceHolder); throw xaException; default: String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(xaException); log.warn("resource '" + failedResourceHolder.getUniqueName() + "' reported " + Decoder.decodeXAExceptionErrorCode(xaException) + " when asked to rollback transaction branch. Transaction is prepared and will rollback via recovery service when resource availability allows." + (extraErrorDetails == null ? "" : " Extra error=" + extraErrorDetails), xaException); } }
" all resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally rolled back", phaseException); else throw new BitronixHeuristicMixedException(message + ":" + (errorResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception" : "") + (errorResources.size() > 0 && heuristicResources.size() > 0 ? " and" : "") + (heuristicResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally rolled back" + (hazard ? " (or hazard happened)" : "") : ""), phaseException);
public void execute() { try { XAResourceHolderState resourceHolder = getResource(); if (log.isDebugEnabled()) log.debug("preparing resource " + resourceHolder); int vote = resourceHolder.getXAResource().prepare(resourceHolder.getXid()); if (vote != XAResource.XA_RDONLY) { preparedResources.add(resourceHolder); } if (log.isDebugEnabled()) log.debug("prepared resource " + resourceHolder + " voted " + Decoder.decodePrepareVote(vote)); } catch (RuntimeException ex) { runtimeException = ex; } catch (XAException ex) { xaException = ex; } }
throw new BitronixXAException("resource already suspended: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) { log.debug("suspending " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } suspended = true; if (log.isDebugEnabled()) { log.debug("ending " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } ended = true; if (log.isDebugEnabled()) { log.debug("ended " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } } catch(XAException ex) {
private void handleXAException(XAResourceHolderState failedResourceHolder, XAException xaException) throws XAException { switch (xaException.errorCode) { case XAException.XA_HEURRB: forgetHeuristicRollback(failedResourceHolder); return; case XAException.XA_HEURCOM: case XAException.XA_HEURHAZ: case XAException.XA_HEURMIX: log.error("heuristic rollback is incompatible with the global state of this transaction - guilty: " + failedResourceHolder); throw xaException; default: String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(xaException); log.warn("resource '" + failedResourceHolder.getUniqueName() + "' reported " + Decoder.decodeXAExceptionErrorCode(xaException) + " when asked to rollback transaction branch. Transaction is prepared and will rollback via recovery service when resource availability allows." + (extraErrorDetails == null ? "" : " Extra error=" + extraErrorDetails), xaException); } }
" all resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally rolled back", phaseException); else throw new BitronixHeuristicMixedException(message + ":" + (errorResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception" : "") + (errorResources.size() > 0 && heuristicResources.size() > 0 ? " and" : "") + (heuristicResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally rolled back" + (hazard ? " (or hazard happened)" : "") : ""), phaseException);
public void execute() { try { XAResourceHolderState resourceHolder = getResource(); if (log.isDebugEnabled()) log.debug("preparing resource " + resourceHolder); int vote = resourceHolder.getXAResource().prepare(resourceHolder.getXid()); if (vote != XAResource.XA_RDONLY) { preparedResources.add(resourceHolder); } if (log.isDebugEnabled()) log.debug("prepared resource " + resourceHolder + " voted " + Decoder.decodePrepareVote(vote)); } catch (RuntimeException ex) { runtimeException = ex; } catch (XAException ex) { xaException = ex; } }
@Override public String getStatusDescription() { return Decoder.decodeStatus(status); }
throw new BitronixXAException("resource hasn't been started, cannot resume it: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) { log.debug("resuming " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } suspended = false; throw new BitronixXAException("resource already started: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) { log.debug("starting " + this + " with " + Decoder.decodeXAResourceFlag(flags)); } started = true; this.started = started; this.ended = false; if (log.isDebugEnabled()) { log.debug("started " + this + " with " + Decoder.decodeXAResourceFlag(flags)); }
private void handleXAException(XAResourceHolderState failedResourceHolder, XAException xaException) throws XAException { switch (xaException.errorCode) { case XAException.XA_HEURRB: forgetHeuristicRollback(failedResourceHolder); return; case XAException.XA_HEURCOM: case XAException.XA_HEURHAZ: case XAException.XA_HEURMIX: log.error("heuristic rollback is incompatible with the global state of this transaction - guilty: " + failedResourceHolder); throw xaException; default: String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(xaException); log.warn("resource '" + failedResourceHolder.getUniqueName() + "' reported " + Decoder.decodeXAExceptionErrorCode(xaException) + " when asked to rollback transaction branch. Transaction is prepared and will rollback via recovery service when resource availability allows." + (extraErrorDetails == null ? "" : " Extra error=" + extraErrorDetails), xaException); } }
" all resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally committed", phaseException); else throw new BitronixHeuristicMixedException(message + ":" + (errorResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(errorResources) + " threw unexpected exception" : "") + (errorResources.size() > 0 && heuristicResources.size() > 0 ? " and" : "") + (heuristicResources.size() > 0 ? " resource(s) " + Decoder.collectResourcesNames(heuristicResources) + " improperly unilaterally committed" + (hazard ? " (or hazard happened)" : "") : ""), phaseException);
@Override public void execute() { try { XAResourceHolderState resourceHolder = getResource(); if (log.isDebugEnabled()) { log.debug("preparing resource " + resourceHolder); } int vote = resourceHolder.getXAResource().prepare(resourceHolder.getXid()); if (vote != XAResource.XA_RDONLY) { preparedResources.add(resourceHolder); } if (log.isDebugEnabled()) { log.debug("prepared resource " + resourceHolder + " voted " + Decoder.decodePrepareVote(vote)); } } catch (RuntimeException ex) { runtimeException = ex; } catch (XAException ex) { xaException = ex; } }
/** * Create human-readable String representation. * @return a human-readable String representing this object's state. */ @Override public String toString() { return "a Bitronix TransactionLogHeader with timestamp=" + timestamp + ", state=" + Decoder.decodeHeaderState(state) + ", position=" + position; }
public void setState(int state) { int oldState = this.state; fireStateChanging(oldState, state); if (oldState == state) throw new IllegalArgumentException("cannot switch state from " + Decoder.decodeXAStatefulHolderState(oldState) + " to " + Decoder.decodeXAStatefulHolderState(state)); if (log.isDebugEnabled()) log.debug("state changing from " + Decoder.decodeXAStatefulHolderState(oldState) + " to " + Decoder.decodeXAStatefulHolderState(state) + " in " + this); this.state = state; fireStateChanged(oldState, state); }
public String getStatusDescription() { return Decoder.decodeStatus(status); }
throw new BitronixXAException("resource hasn't been started, cannot resume it: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) log.debug("resuming " + this + " with " + Decoder.decodeXAResourceFlag(flags)); suspended = false; throw new BitronixXAException("resource already started: " + this, XAException.XAER_PROTO); if (log.isDebugEnabled()) log.debug("starting " + this + " with " + Decoder.decodeXAResourceFlag(flags)); started = true; this.started = started; this.ended = false; if (log.isDebugEnabled()) log.debug("started " + this + " with " + Decoder.decodeXAResourceFlag(flags));