HHH-7265 : Test case to repro ConcurrentModificationException
This commit is contained in:
parent
481af0f37c
commit
ac5ef8108a
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.ejb.test.transaction;
|
package org.hibernate.ejb.test.transaction;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.transaction.Synchronization;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
@ -108,4 +109,34 @@ public class TransactionJoiningTest extends BaseEntityManagerFunctionalTestCase
|
||||||
|
|
||||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImplicitJoiningWithExtraSynchronization() throws Exception {
|
||||||
|
assertFalse( JtaStatusHelper.isActive( TestingJtaBootstrap.INSTANCE.getTransactionManager() ) );
|
||||||
|
|
||||||
|
TestingJtaBootstrap.INSTANCE.getTransactionManager().begin();
|
||||||
|
EntityManager entityManager = entityManagerFactory().createEntityManager();
|
||||||
|
SessionImplementor session = entityManager.unwrap( SessionImplementor.class );
|
||||||
|
Transaction hibernateTransaction = ( (Session) session ).getTransaction();
|
||||||
|
assertTrue( CMTTransaction.class.isInstance( hibernateTransaction ) );
|
||||||
|
assertTrue( session.getTransactionCoordinator().isSynchronizationRegistered() );
|
||||||
|
assertTrue( hibernateTransaction.isParticipating() );
|
||||||
|
|
||||||
|
entityManager.close();
|
||||||
|
|
||||||
|
//assertTrue( entityManager.isOpen() );
|
||||||
|
hibernateTransaction.registerSynchronization(
|
||||||
|
new Synchronization() {
|
||||||
|
public void beforeCompletion() {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
public void afterCompletion( int i ) {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue