mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1169 - Memory leak - DefaultTransactionThreadLocal holding reference to transaction - test case
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package io.ebeaninternal.server.transaction;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebeaninternal.api.SpiTransaction;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class DefaultTransactionThreadLocalTest extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void get() throws Exception {
|
||||
|
||||
if (isH2()) {
|
||||
Ebean.execute(() -> {
|
||||
SpiTransaction txn = DefaultTransactionThreadLocal.get("h2");
|
||||
assertNotNull(txn);
|
||||
});
|
||||
|
||||
// thread local should be set to null
|
||||
assertNull(DefaultTransactionThreadLocal.get("h2"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user