/** * Creates a XA recovery registry for a transaction. This method assumes that there is no file already * existing for this transaction, and, furthermore, it is not thread safe (the creation of this object is * already thread protected at the caller). * * @param xid the transaction xid * @throws SystemException if the there was a problem when creating the recovery file in file system */ XAResourceRegistryFile(Xid xid) throws SystemException { xaRecoveryPath.toFile().mkdir(); // create dir if non existent final String xidString = SimpleXid.of(xid).toHexString('_'); this.filePath = xaRecoveryPath.resolve(xidString); openFilePaths.add(xidString); try { fileChannel = FileChannel.open(filePath, StandardOpenOption.APPEND, StandardOpenOption.CREATE_NEW); fileChannel.lock(); Log.log.xaResourceRecoveryFileCreated(filePath); } catch (IOException e) { throw Log.log.createXAResourceRecoveryFileFailed(filePath, e); } }
public void forget(final Xid xid) throws XAException { try { Entry entry = known.get(SimpleXid.of(xid).withoutBranch()); if (entry != null) { entry.forget(); } else { throw new XAException(XAException.XAER_NOTA); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void commit(final Xid xid, final boolean onePhase) throws XAException { try { Entry entry = known.get(SimpleXid.of(xid).withoutBranch()); if (entry != null) { entry.commit(onePhase); } else { throw new XAException(XAException.XAER_NOTA); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void dropLocal(@NotNull final Transaction transaction) { final Xid xid = getXid(transaction); final SimpleXid gtid = SimpleXid.of(xid).withoutBranch(); final Entry entry = known.remove(gtid); if (entry != null) { timeoutSet.remove(entry.getXidKey()); } }
public Transaction findExistingTransaction(final Xid xid) throws XAException { try { final SimpleXid simpleXid = SimpleXid.of(xid); final SimpleXid gtid = simpleXid.withoutBranch(); final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known; Entry entry = known.get(gtid); if (entry != null) { return entry.getTransaction(); } final Transaction transaction = ext.getTransaction(xid); if (transaction == null) { return null; } return known.computeIfAbsent(gtid, g -> getEntryFor(transaction, g)).getTransaction(); } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void commitLocal(@NotNull final Transaction transaction) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).commitLocal(); }
public void rollbackLocal(@NotNull final Transaction transaction) throws IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).rollbackLocal(); }
public void commitLocal(@NotNull final Transaction transaction) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).commitLocal(); }
public void rollbackLocal(@NotNull final Transaction transaction) throws IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).rollbackLocal(); }
public ImportResult<Transaction> findOrImportTransaction(final Xid xid, final int timeout, final boolean doNotImport) throws XAException { try { final SimpleXid simpleXid = SimpleXid.of(xid); final SimpleXid gtid = simpleXid.withoutBranch(); final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known;
tm.begin(); final Transaction transaction = tm.suspend(); SimpleXid gtid = SimpleXid.of(getXid(transaction)).withoutBranch(); known.put(gtid, getEntryFor(transaction, gtid));
public void commit(final Xid xid, final boolean onePhase) throws XAException { try { Entry entry = known.get(SimpleXid.of(xid).withoutBranch()); if (entry != null) { entry.commit(onePhase); } else { throw new XAException(XAException.XAER_NOTA); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void forget(final Xid xid) throws XAException { try { Entry entry = known.get(SimpleXid.of(xid).withoutBranch()); if (entry != null) { entry.forget(); } else { throw new XAException(XAException.XAER_NOTA); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void commit(final Xid xid, final boolean onePhase) throws XAException { try { Entry entry = known.get(SimpleXid.of(xid).withoutBranch()); if (entry != null) { entry.commit(onePhase); } else { throw new XAException(XAException.XAER_NOTA); } } catch (XAException e) { throw e; } catch (Throwable t) { throw Log.log.resourceManagerErrorXa(XAException.XAER_RMFAIL, t); } }
public void dropLocal(@NotNull final Transaction transaction) { final Xid xid = getXid(transaction); final SimpleXid gtid = SimpleXid.of(xid).withoutBranch(); final Entry entry = known.remove(gtid); if (entry != null) { timeoutSet.remove(entry.getXidKey()); } }
public void dropLocal(@NotNull final Transaction transaction) { final Xid xid = getXid(transaction); final SimpleXid gtid = SimpleXid.of(xid).withoutBranch(); final Entry entry = known.remove(gtid); if (entry != null) { timeoutSet.remove(entry.getXidKey()); } }
public void rollbackLocal(@NotNull final Transaction transaction) throws IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).rollbackLocal(); }
public void commitLocal(@NotNull final Transaction transaction) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).commitLocal(); }
public void rollbackLocal(@NotNull final Transaction transaction) throws IllegalStateException, SystemException { getEntryFor(transaction, SimpleXid.of(getXid(transaction)).withoutBranch()).rollbackLocal(); }