@@ -217,27 +217,27 @@ are declared in the
217
217
#### Support for Supplier and Publisher as Option Values
218
218
Most options can have a value provided by a ` Supplier ` or ` Publisher ` .
219
219
220
- Oracle R2DBC requests the value of a ` Option ` from a ` Supplier ` or ` Publisher `
221
- each time ` ConnectionFactory.create() ` is called to create a new ` Connection ` . This
222
- allows connections to be configured with values that change over time, such as a
223
- password that gets periodically rotated.
220
+ Oracle R2DBC requests the value of an ` Option ` from a ` Supplier ` or ` Publisher `
221
+ each time the ` Publisher ` returned by ` ConnectionFactory.create() ` creates a new
222
+ ` Connection ` . Each ` Connection ` can then be configured with values that change
223
+ over time, such as a password which is periodically rotated.
224
224
225
225
If a ` Supplier ` provides the value of an ` Option ` , then Oracle R2DBC requests
226
226
the value by invoking ` Supplier.get() ` . If ` get() ` returns ` null ` ,
227
227
then no value is configured for the ` Option ` . If ` get() ` throws a
228
228
` RuntimeException ` , then it is set as the initial cause of an
229
- ` R2dbcException ` emitted by the ` create() ` ` Publisher ` . If concurrent
230
- access to a ` ConnectionFactory ` is possible, then the ` Supplier ` must have a
231
- thread safe ` get() ` method, as multiple threads may invoke
232
- ` ConnectionFactory.create() ` concurrently.
229
+ ` R2dbcException ` emitted by the ` Publisher ` returned by
230
+ ` ConnectionFactory.create() ` . The ` Supplier ` must have a thread safe ` get() `
231
+ method, as multiple subscribers may request connections concurrently.
233
232
234
233
If a ` Publisher ` provides the value of an ` Option ` , then Oracle R2DBC requests
235
234
the value by subscribing to the ` Publisher ` and signalling demand.
236
235
The first value emitted to ` onNext ` will be used as the value of the ` Option ` .
237
236
If the ` Publisher ` emits ` onComplete ` before ` onNext ` , then no value is
238
237
configured for the ` Option ` . If the ` Publisher ` emits ` onError ` before ` onNext ` ,
239
- then the ` Throwable ` is set as the initial cause of an ` R2dbcException ` emitted
240
- by the ` create() ` ` Publisher ` .
238
+ then the ` Throwable ` is set as the initial cause of an
239
+ ` R2dbcException ` emitted by the ` Publisher ` returned by
240
+ ` ConnectionFactory.create() ` .
241
241
242
242
The following example configures the ` PASSWORD ` option with a ` Supplier ` :
243
243
``` java
@@ -253,7 +253,7 @@ The following example configures the `PASSWORD` option with a `Supplier`:
253
253
optionsBuilder. option(suppliedOption, supplier);
254
254
}
255
255
```
256
- A similar and more concise example configures ` TLS_WALLET_PASSWORD ` as a ` Publisher `
256
+ A more concise example configures ` TLS_WALLET_PASSWORD ` as a ` Publisher `
257
257
``` java
258
258
void configurePassword(ConnectionFactoryOptions . Builder optionsBuilder) {
259
259
optionsBuilder. option(
@@ -263,13 +263,12 @@ A similar and more concise example configures `TLS_WALLET_PASSWORD` as a `Publis
263
263
```
264
264
These examples use the ` supplied(Option) ` and ` published(Option) ` methods
265
265
declared by ` oracle.r2dbc.OracleR2dbcOptions ` . These methods cast an ` Option<T> `
266
- to ` Option<Supplier<T>> ` or ` Option<Publisher<T>> ` , respectively. Casting the
267
- ` Option ` is required for
268
- ` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` to compile and not throw
269
- a ` ClassCastException ` at runtime.
270
-
271
- It is not strictly necessary to use the ` supplied(Option) ` or ` published(Option) ` methods when
272
- casting the ` Option ` . These methods are offered only for code readability and
266
+ to ` Option<Supplier<T>> ` and ` Option<Publisher<T>> ` , respectively. It is
267
+ necessary to cast the generic type of the ` Option ` when calling
268
+ ` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` in order for the call to
269
+ compile and not throw a ` ClassCastException ` at runtime. It is not strictly
270
+ required that ` supplied(Option) ` or ` published(Option) ` be used to cast the
271
+ ` Option ` . These methods are only meant to offer code readability and
273
272
convenience.
274
273
275
274
Note that the following code would compile, but fails at runtime with a
@@ -285,8 +284,8 @@ To avoid a `ClassCastException`, the generic type of an `Option` must match the
285
284
actual type of the value passed to
286
285
` ConnectionFactoryOptions.Builder.option(Option<T>, T) ` .
287
286
288
- Providing values with a ` Supplier ` or ` Publisher ` is not supported for a small
289
- set of options :
287
+ For a small set of options, providing values with a ` Supplier ` or ` Publisher `
288
+ is not supported :
290
289
- ` DRIVER `
291
290
- ` PROTOCOL `
292
291
0 commit comments