Refine search
public void markBusinessStageRollbackOnly(TransactionXid transactionXid) throws SystemException { String global = ByteUtils.byteArrayToString(transactionXid.getGlobalTransactionId()); String parent = String.format("%s/%s/rollback", CONSTANTS_ROOT_PATH, CommonUtils.getApplication(this.endpoint)); String target = String.format("%s/%s", parent, global); try { byte[] instanceByteArray = this.endpoint == null ? new byte[0] : this.endpoint.getBytes(); this.curatorFramework.create().withMode(CreateMode.PERSISTENT).forPath(target, instanceByteArray); } catch (NodeExistsException error) { logger.debug("Path exists(path= {})!", target); // ignore } catch (Exception error) { SystemException systemEx = new SystemException(XAException.XAER_RMERR); systemEx.initCause(error); throw systemEx; } }
@Override public final SystemException internalSystemErrorWithTx(final Throwable t) { final SystemException result = new SystemException(String.format(getLoggingLocale(), internalSystemErrorWithTx$str())); result.initCause(t); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
@Override public final SystemException responseFailed(final IOException cause) { final SystemException result = new SystemException(String.format(getLoggingLocale(), responseFailed$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String peerIllegalStateException = "WFTXN0046: The peer threw an IllegalStateException; see peer logs for more information";
@Override public final SystemException failedToSend(final Exception e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), failedToSend$str())); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String peerSystemException = "WFTXN0012: The peer threw a SystemException; see peer logs for more information";
@Override public final SystemException failedToAcquireConnection(final IOException reason) { final SystemException result = new SystemException(String.format(getLoggingLocale(), failedToAcquireConnection$str())); result.initCause(reason); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String duplicateEnlistment = "WFTXN0022: The resource manager for remote connection to %s was already enlisted in a transaction";
@Override public final SystemException failedToReceive(final IOException e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), failedToReceive$str())); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String failedToSend = "WFTXN0011: Failed to send protocol message to remote peer";
@Override public final SystemException setTimeoutFailed(final int timeout, final XAException e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), setTimeoutFailed$str(), timeout)); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String locationAlreadyInitialized = "WFTXN0090: Cannot assign location \"%s\" to transaction because it is already located at \"%s\"";
@Override public final SystemException appendXAResourceRecoveryFileFailed(final URI uri, final Path filePath, final IOException e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), appendXAResourceRecoveryFileFailed$str(), uri, filePath)); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String deleteXAResourceRecoveryFileFailed = "WFTXN0093: Failed to delete xa recovery registry file %s on removal of %s";
@Override public final SystemException connectionFailed(final Throwable cause) { final SystemException result = new SystemException(String.format(getLoggingLocale(), connectionFailed$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String connectionInterrupted = "WFTXN0043: Connection to remote transaction service interrupted";
@Override public final SystemException unexpectedException(final Exception e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), unexpectedException$str())); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unknownTransactionType = "WFTXN0086: Unexpected transaction type encountered; expected %s but encountered %s";
@Override public final SystemException createXAResourceRecoveryFileFailed(final Path filePath, final IOException e) { final SystemException result = new SystemException(String.format(getLoggingLocale(), createXAResourceRecoveryFileFailed$str(), filePath)); result.initCause(e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String appendXAResourceRecoveryFileFailed = "WFTXN0092: Failed to append xa resource (%s) to xa recovery file: %s";
if (VERBOSE) writer.fine(exception, e); SystemException se = new SystemException(exception); se.initCause(e);
@Override public boolean enlistResource(XAResource xaRes) throws IllegalStateException, SystemException { TestXid testXid = xids.get(xaRes); if (testXid == null) { testXid = new TestXid(gtrid, bqualGenerator.incrementAndGet()); xids.put(xaRes, testXid); } try { xaRes.start(testXid, XAResource.TMNOFLAGS); } catch (XAException e) { throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e); } return true; }
logger.error("{}| confirm native/remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); SystemException sysEx = new SystemException(XAException.XAER_RMERR); sysEx.initCause(ex); throw sysEx; } catch (RollbackException ex) { logger.error("{}| confirm native/remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); SystemException sysEx = new SystemException(XAException.XAER_RMERR); sysEx.initCause(ex); throw sysEx; } catch (HeuristicMixedException ex) { logger.error("{}| confirm native/remote branchs failed!", ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); SystemException sysEx = new SystemException(XAException.XA_HEURMIX); sysEx.initCause(ex); throw sysEx; } catch (HeuristicRollbackException ex) { ByteUtils.byteArrayToString(this.transactionContext.getXid().getGlobalTransactionId()), ex); SystemException sysEx = new SystemException(XAException.XA_HEURRB); sysEx.initCause(ex); throw sysEx;
} catch (XAException ex) { logger.error("Error occurred while beginning an compensable transaction!", ex); throw new SystemException(ex.getMessage()); case XAException.XAER_RMFAIL: default: SystemException systemEx = new SystemException(xaex.errorCode); systemEx.initCause(xaex); throw systemEx;
if (VERBOSE) writer.fine(exception); SystemException sysEx = new SystemException(exception); sysEx.initCause(e); throw sysEx; } finally {
@Override public void rollback() throws IllegalStateException, SystemException { try { Set<Map.Entry<XAResource, TestXid>> entries = xids.entrySet(); // delist for (Map.Entry<XAResource, TestXid> entry : entries) { try { entry.getKey().end(entry.getValue(), XAResource.TMSUCCESS); } catch (XAException e) { throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e); } } // rollback for (Map.Entry<XAResource, TestXid> entry : entries) { try { entry.getKey().rollback(entry.getValue()); } catch (XAException e) { throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e); } } } finally { fireAfterCompletion(Status.STATUS_ROLLEDBACK); } }
static SystemException readAppException(final EJBClientChannel channel, final BlockingInvocation.Response response) throws SystemException { Exception e; try (final Unmarshaller unmarshaller = channel.createUnmarshaller()) { try (MessageInputStream inputStream = response.getInputStream()) { unmarshaller.start(Marshalling.createByteInput(inputStream)); e = unmarshaller.readObject(Exception.class); unmarshaller.finish(); // The version is probably < 3 else we would not be here // drain off attachments so the server doesn't complain while (inputStream.read() != -1) { inputStream.skip(Long.MAX_VALUE); } } } catch (IOException | ClassNotFoundException e1) { throw new SystemException(); } if (e == null) { throw new SystemException(); } try { throw e; } catch (RuntimeException | SystemException e1) { throw e1; } catch (Exception e1) { final SystemException e2 = new SystemException(); e2.initCause(e1); return e2; } }
entry.getKey().end(entry.getValue(), XAResource.TMSUCCESS); } catch (XAException e) { throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e); throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e); throw (SystemException) new SystemException(XAException.XAER_RMERR).initCause(e);
} catch (XAException ex) { logger.error("Error occurred while beginning an compensable transaction!", ex); throw new SystemException(ex.getMessage()); case XAException.XAER_RMFAIL: default: SystemException systemEx = new SystemException(xaex.errorCode); systemEx.initCause(xaex); throw systemEx;