Skip to content

Commit c801c10

Browse files
Only check for 0 parallelism property
1 parent 53e5f71 commit c801c10

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/main/java/oracle/r2dbc/impl/OracleConnectionFactoryImpl.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,13 @@ final class OracleConnectionFactoryImpl implements ConnectionFactory {
108108
* configured. It will use the common {@code ForkJoinPool}, unless it has
109109
* a maximum pool size of 0. See:
110110
* https://github.com/oracle/oracle-r2dbc/issues/129
111-
* </p><p>
112-
* As of JDK 11, it appears that ForkJoinPool does not expose a
113-
* maximum pool size. {@link ForkJoinPool#getCommonPoolParallelism()} and
114-
* {@link ForkJoinPool#getParallelism()} will return 1 when the maximum pool
115-
* size is 0. For this reason, the conditional below will check for a
116-
* parallelism that is greater than 1, rather than 0. It is noted that
117-
* {@code CompletableFuture} uses the same logic when initializing its
118-
* USE_COMMON_POOL field.
119111
* </p>
120112
*/
121113
private static final Executor DEFAULT_EXECUTOR =
122-
ForkJoinPool.getCommonPoolParallelism() > 1
123-
? ForkJoinPool.commonPool()
124-
: new ForkJoinPool(1);
114+
"0".equals(System.getProperty(
115+
"java.util.concurrent.ForkJoinPool.common.parallelism"))
116+
? new ForkJoinPool(1)
117+
: ForkJoinPool.commonPool();
125118

126119
/** JDBC data source that this factory uses to open connections */
127120
private final DataSource dataSource;

0 commit comments

Comments
 (0)