File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
frameworks/Java/helidon/nima/src/main/java/io/helidon/benchmark/nima/models Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 77import java .sql .SQLException ;
88import java .util .ArrayList ;
99import java .util .List ;
10+ import java .util .concurrent .Executors ;
11+ import java .util .concurrent .ThreadFactory ;
1012import java .util .logging .Logger ;
1113
1214import com .zaxxer .hikari .HikariConfig ;
@@ -36,6 +38,11 @@ public HikariJdbcRepository(Config config) {
3638 int poolSize = config .get ("sql-pool-size" ).asInt ().orElse (64 );
3739 hikariConfig .addDataSourceProperty ("maximumPoolSize" , poolSize );
3840 LOGGER .info ("Db pool size is set to " + poolSize );
41+
42+ // use VTs with Hikari
43+ ThreadFactory vtThreadFactory = Thread .ofVirtual ().factory ();
44+ hikariConfig .setThreadFactory (vtThreadFactory );
45+ hikariConfig .setScheduledExecutor (Executors .newScheduledThreadPool (poolSize , vtThreadFactory ));
3946 }
4047
4148 private Connection getConnection () throws SQLException {
You can’t perform that action at this time.
0 commit comments