Skip to content

Commit

Permalink
Merge pull request #56 from ochaloup/WFTC-52-closing-xa-terminator
Browse files Browse the repository at this point in the history
[WFTC-52] calling XATerminator when subordinate transaction is removed
  • Loading branch information
dmlloyd authored Jun 8, 2018
2 parents abf240c + e840d92 commit 2802ea2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public interface Log extends BasicLogger {
@Message(value = "Unknown I/O error when listing xa resource recovery files in %s (File.list() returned null)")
void listXAResourceRecoveryFilesNull(File dir);

@LogMessage(level = Logger.Level.WARN)
@Message(value = "Error while removing imported transaction of xid %s from the underlying transaction manager")
void cannotRemoveImportedTransaction(Xid xid, @Cause XAException e);

// Debug

Expand Down Expand Up @@ -112,6 +115,10 @@ public interface Log extends BasicLogger {
@Message(value = "Recovered in doubt xa resource (%s) from xa resource recovery registry %s")
void xaResourceRecoveredFromRecoveryRegistry(URI uri, Path filePath);

@LogMessage(level = Logger.Level.TRACE)
@Message(value = "Unknown xid %s to be removed from the instances known to the wfly txn client")
void unknownXidToBeRemovedFromTheKnownTransactionInstances(Xid xid);

// Regular messages

@Message(id = 0, value = "No transaction associated with the current thread")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,22 @@ public void afterCompletion(final int status) {
final ConcurrentMap<SimpleXid, Entry> known = JBossLocalTransactionProvider.this.known;
final Iterator<XidKey> iterator = timeoutSet.headSet(new XidKey(SimpleXid.EMPTY, timeTick)).iterator();
while (iterator.hasNext()) {
known.remove(iterator.next().getId());
SimpleXid xidToRemove = iterator.next().getId();
Entry knownEntry = known.remove(xidToRemove);

if (knownEntry == null) {
Log.log.unknownXidToBeRemovedFromTheKnownTransactionInstances(xidToRemove);
} else {
final Transaction transaction = knownEntry.getTransaction();
if (transaction instanceof ImportedTransaction) {
try {
ext.removeImportedTransaction(getXid(transaction));
} catch (XAException xae) {
Log.log.cannotRemoveImportedTransaction(xidToRemove, xae);
}
}
}

iterator.remove();
}
}
Expand Down

0 comments on commit 2802ea2

Please # to comment.