The BaseTestCase ensures, that the threadLocal is cleared after each test. (#1712)

* The BaseTestCase ensures, that the threadLocal is cleared after each test.

* Change JdbcTransaction.toString to distingush between active and inactive transaction
This commit is contained in:
Roland Praml
2019-05-18 11:28:46 +12:00
committed by Rob Bygrave
parent 2678f85506
commit 895b5ee4ff
3 changed files with 36 additions and 1 deletions
@@ -75,6 +75,14 @@ public final class DefaultTransactionThreadLocal {
return local.get().get(serverName);
}
/**
* Return all transactions of the current thread (active/inactive).
* This is intended for test/debugging purposes only!
*/
public static Map<String, SpiTransaction> currentTransactions() {
return local.get();
}
private static SpiTransaction obtain(String serverName) {
SpiTransaction transaction = local.get().remove(serverName);
if (transaction == null) {
@@ -314,7 +314,11 @@ public class JdbcTransaction implements SpiTransaction, TxnProfileEventCodes {
@Override
public String toString() {
return logPrefix;
if (active) {
return logPrefix;
} else {
return logPrefix + "(inactive)";
}
}
@Override