mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
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:
committed by
Rob Bygrave
parent
2678f85506
commit
895b5ee4ff
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user