@@ -220,19 +220,19 @@ Most options can have a value provided by a `Supplier` or `Publisher`.
220
220
Oracle R2DBC requests the value of a ` Option ` from a ` Supplier ` or ` Publisher `
221
221
each time ` ConnectionFactory.create() ` is called to create a new ` Connection ` . This
222
222
allows connections to be configured with values that change over time, such as a
223
- password that is periodically rotated.
223
+ password that gets periodically rotated.
224
224
225
- If an ` Option ` is configured as a ` Supplier ` , then Oracle R2DBC requests the
226
- value of that ` Option ` by invoking its ` get() ` method. If concurrent
225
+ If a ` Supplier ` provides the value of an ` Option ` , then Oracle R2DBC requests
226
+ the value by invoking ` Supplier.get() ` method. If the ` get() ` returns ` null ` ,
227
+ then no value is configured for the ` Option ` . If ` get() ` throws a
228
+ ` RuntimeException ` , then it is set as the initial cause of an
229
+ ` R2dbcException ` emitted by the ` create() ` ` Publisher ` . If concurrent
227
230
access to a ` ConnectionFactory ` is possible, then the ` Supplier ` must have a
228
231
thread safe ` get() ` method, as multiple threads may invoke
229
- ` ConnectionFactory.create() ` concurrently. If the ` Supplier ` returns ` null ` ,
230
- then no value is configured for the ` Option ` . If the ` Supplier ` throws a
231
- ` RuntimeException ` , then it is set as the initial cause of an
232
- ` R2dbcException ` emitted by the ` create() ` ` Publisher ` .
232
+ ` ConnectionFactory.create() ` concurrently.
233
233
234
- If an ` Option ` is configured as a ` Publisher ` , then Oracle R2DBC requests the
235
- value of that ` Option ` by subscribing to the ` Publisher ` and signalling demand.
234
+ If a ` Publisher ` provides the value of an ` Option ` , then Oracle R2DBC requests
235
+ the value by subscribing to the ` Publisher ` and signalling demand.
236
236
The first value emitted to ` onNext ` will be used as the value of the ` Option ` .
237
237
If the ` Publisher ` emits ` onComplete ` before ` onNext ` , then no value is
238
238
configured for the ` Option ` . If the ` Publisher ` emits ` onError ` before ` onNext ` ,
@@ -247,7 +247,7 @@ The following example configures the `PASSWORD` option with a `Supplier`:
247
247
Option<Supplier<CharSequence > > suppliedOption = OracleR2dbcOptions . supplied(PASSWORD );
248
248
249
249
// Supply a password
250
- Supplier<CharSequence > supplier = () - > getCurrentPassword ();
250
+ Supplier<CharSequence > supplier = () - > getPassword ();
251
251
252
252
// Configure the builder
253
253
optionsBuilder. option(suppliedOption, supplier);
@@ -276,7 +276,7 @@ Note that the following code would compile, but fails at runtime with a
276
276
` ClassCastException ` :
277
277
``` java
278
278
void configurePassword(ConnectionFactoryOptions . Builder optionsBuilder) {
279
- Publisher<CharSequence > publisher = Mono . fromSupplier(() - > getPassword())) ;
279
+ Publisher<CharSequence > publisher = Mono . fromSupplier(() - > getPassword());
280
280
// Doesn't work. Throws ClassCastException at runtime:
281
281
optionsBuilder. option(PASSWORD , PASSWORD . cast(publisher));
282
282
}
@@ -285,6 +285,14 @@ To avoid a `ClassCastException`, the generic type of an `Option` must match the
285
285
actual type of the value passed to
286
286
` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` .
287
287
288
+ Providing values with a ` Supplier ` or ` Publisher ` is not supported for a small
289
+ set of options:
290
+ - ` DRIVER `
291
+ - ` PROTOCOL `
292
+
293
+ Providing values for these options would not be interoperable with
294
+ ` io.r2dbc.spi.ConnectionFactories ` and ` r2dbc-pool ` .
295
+
288
296
#### Configuring an Oracle Net Descriptor
289
297
The ` oracle.r2dbc.OracleR2dbcOptions.DESCRIPTOR ` option may be used to configure
290
298
an Oracle Net Descriptor of the form ``` (DESCRIPTION=...) ``` . If this option is
0 commit comments