Skip to content

Commit 7fdc676

Browse files
committed
[#1649] Set connection pool timeout for multithreaded id generation tests
I don't why, but without it, these tests can stop with a timeout exception. It happens to me with MySQL when I test the build with all databases and to Barry when testing MSSQL and JUnit 5. These tests are configured differently than the others, so it's not a critical issue.
1 parent 33c68a8 commit 7fdc676

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedIdentityGenerationTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import jakarta.persistence.Table;
4747

4848
import static org.hibernate.cfg.AvailableSettings.SHOW_SQL;
49+
import static org.hibernate.reactive.BaseReactiveTest.setDefaultProperties;
50+
import static org.hibernate.reactive.provider.Settings.POOL_CONNECT_TIMEOUT;
4951

5052
/**
5153
* This is a multi-threaded stress test, intentionally consuming some time.
@@ -95,10 +97,10 @@ public static void setupSessionFactory() {
9597
vertxOptions.setBlockedThreadCheckIntervalUnit( TimeUnit.MINUTES );
9698
vertx = Vertx.vertx( vertxOptions );
9799
Configuration configuration = new Configuration();
100+
setDefaultProperties( configuration );
98101
configuration.addAnnotatedClass( EntityWithGeneratedId.class );
99-
BaseReactiveTest.setDefaultProperties( configuration );
100102
configuration.setProperty( SHOW_SQL, String.valueOf( LOG_SQL ) );
101-
BaseReactiveTest.setDefaultProperties( configuration );
103+
configuration.setProperty( POOL_CONNECT_TIMEOUT, String.valueOf( TIMEOUT_MINUTES * 60 * 1000 ) );
102104
StandardServiceRegistryBuilder builder = new ReactiveServiceRegistryBuilder()
103105
.applySettings( configuration.getProperties() )
104106
//Inject our custom vert.x instance:

hibernate-reactive-core/src/test/java/org/hibernate/reactive/MultithreadedInsertionTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import jakarta.persistence.Table;
3737

3838
import static org.hibernate.cfg.AvailableSettings.SHOW_SQL;
39+
import static org.hibernate.reactive.BaseReactiveTest.setDefaultProperties;
40+
import static org.hibernate.reactive.provider.Settings.POOL_CONNECT_TIMEOUT;
3941
import static org.hibernate.reactive.util.impl.CompletionStages.loop;
4042

4143
/**
@@ -101,9 +103,10 @@ public static void setupSessionFactory() {
101103
vertxOptions.setBlockedThreadCheckIntervalUnit( TimeUnit.MINUTES );
102104
vertx = Vertx.vertx( vertxOptions );
103105
Configuration configuration = new Configuration();
106+
setDefaultProperties( configuration );
104107
configuration.addAnnotatedClass( EntityWithGeneratedId.class );
105-
BaseReactiveTest.setDefaultProperties( configuration );
106108
configuration.setProperty( SHOW_SQL, String.valueOf( LOG_SQL ) );
109+
configuration.setProperty( POOL_CONNECT_TIMEOUT, String.valueOf( TIMEOUT_MINUTES * 60 * 1000 ) );
107110
StandardServiceRegistryBuilder builder = new ReactiveServiceRegistryBuilder()
108111
.applySettings( configuration.getProperties() )
109112
//Inject our custom vert.x instance:

0 commit comments

Comments
 (0)