File tree Expand file tree Collapse file tree 3 files changed +22
-5
lines changed
test/java/oracle/r2dbc/impl Expand file tree Collapse file tree 3 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,11 @@ private OracleR2dbcOptions() {}
5656 * ...
5757 * .build();
5858 * </pre>
59- * If this option is not configured, then Oracle R2DBC will use
60- * {@code ForkJoinPool}'s
61- * {@linkplain ForkJoinPool#commonPool() common pool} by default.
59+ * If this option is not configured, then Oracle R2DBC will
60+ * use the {@linkplain ForkJoinPool#commonPool() common ForkJoinPool} by
61+ * default. However, if the common {@code ForkJoinPool} has a maximum pool
62+ * size that is potentially zero, then a single-threaded {@code Executor} will
63+ * be used by default.
6264 */
6365 public static final Option <Executor > EXECUTOR ;
6466
Original file line number Diff line number Diff line change 102102 */
103103final class OracleConnectionFactoryImpl implements ConnectionFactory {
104104
105+ /**
106+ * <p>
107+ * The default executor when {@link OracleR2dbcOptions#EXECUTOR} is not
108+ * configured. It will use the common {@code ForkJoinPool}, unless it has
109+ * a maximum pool size of 0. See:
110+ * https://github.com/oracle/oracle-r2dbc/issues/129
111+ * </p>
112+ */
113+ private static final Executor DEFAULT_EXECUTOR =
114+ "0" .equals (System .getProperty (
115+ "java.util.concurrent.ForkJoinPool.common.parallelism" ))
116+ ? new ForkJoinPool (1 )
117+ : ForkJoinPool .commonPool ();
118+
105119 /** JDBC data source that this factory uses to open connections */
106120 private final DataSource dataSource ;
107121
@@ -200,7 +214,7 @@ final class OracleConnectionFactoryImpl implements ConnectionFactory {
200214
201215 Object executor = options .getValue (OracleR2dbcOptions .EXECUTOR );
202216 if (executor == null ) {
203- this .executor = ForkJoinPool . commonPool () ;
217+ this .executor = DEFAULT_EXECUTOR ;
204218 }
205219 else if (executor instanceof Executor ) {
206220 this .executor = (Executor ) executor ;
@@ -267,4 +281,5 @@ public Publisher<Connection> create() {
267281 public ConnectionFactoryMetadata getMetadata () {
268282 return () -> "Oracle Database" ;
269283 }
284+
270285}
Original file line number Diff line number Diff line change @@ -3222,7 +3222,7 @@ private void verifyConcurrentFetch(Connection connection) {
32223222 // Create many statements and execute them in parallel.
32233223 @ SuppressWarnings ({"unchecked" ,"rawtypes" })
32243224 Publisher <Long >[] publishers =
3225- new Publisher [Runtime .getRuntime ().availableProcessors () * 4 ];
3225+ new Publisher [Runtime .getRuntime ().availableProcessors () * 2 ];
32263226
32273227 for (int i = 0 ; i < publishers .length ; i ++) {
32283228
You can’t perform that action at this time.
0 commit comments